Package alluxio.resource
Class CloseableResource<T>
- java.lang.Object
-
- alluxio.resource.CloseableResource<T>
-
- Type Parameters:
T
- the type of the wrapped resource
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
BlockLock
,CloseableIterator
,PooledResource
public abstract class CloseableResource<T> extends java.lang.Object implements java.io.Closeable
ACloseableResource<T>
is a wrapper around a resource of typeT
which must do some sort of cleanup when it is no longer in use.
-
-
Constructor Summary
Constructors Constructor Description CloseableResource(T resource)
Creates aCloseableResource
wrapper around the given resource.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
abstract void
closeResource()
Performs any cleanup operations necessary when the resource is no longer in use.T
get()
-
-
-
Constructor Detail
-
CloseableResource
public CloseableResource(T resource)
Creates aCloseableResource
wrapper around the given resource. This resource will be returned by theget()
method.- Parameters:
resource
- the resource to wrap
-
-
Method Detail
-
get
public T get()
- Returns:
- the resource
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
closeResource
public abstract void closeResource()
Performs any cleanup operations necessary when the resource is no longer in use.
-
-