T
- the type of the wrapped resourcepublic abstract class CloseableResource<T> extends Object implements Closeable
CloseableResource<T>
is a wrapper around a resource of type T
which must do
some sort of cleanup when it is no longer in use.Constructor and Description |
---|
CloseableResource(T resource)
Creates a
CloseableResource wrapper around the given resource. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
abstract void |
closeResource()
Performs any cleanup operations necessary when the resource is no longer in use.
|
T |
get() |
public CloseableResource(T resource)
CloseableResource
wrapper around the given resource. This resource will
be returned by the get()
method.resource
- the resource to wrappublic T get()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public abstract void closeResource()
Copyright © 2023. All Rights Reserved.