- java.lang.Object
-
- soot.util.SharedCloseable<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
AutoCloseable
public final class SharedCloseable<T extends Closeable> extends Object implements AutoCloseable
Reference counting wrapper for aCloseable
that closes the resource when the reference count reaches0
. ExtendsAutoCloseable
so that each region using the resource can simply be wrapped in a try-with-resources block.- Author:
- Timothy Hoffman
- See Also:
AutoCloseable
-
-
Constructor Summary
Constructors Constructor Description SharedCloseable(T resource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SharedCloseable<T>
acquire()
void
close()
T
get()
boolean
release()
-
-
-
Constructor Detail
-
SharedCloseable
public SharedCloseable(T resource)
-
-
Method Detail
-
acquire
public SharedCloseable<T> acquire()
-
release
public boolean release()
-
get
public T get()
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-