Package org.apache.cassandra.utils
Interface WithResources
-
- All Known Implementing Classes:
ExecutorLocals,WithResources.None
public interface WithResourcesA generic interface for encapsulating a Runnable task with related work before and after execution, using the built-in try-with-resources functionality offered byCloseable. SeeExecutorPlus.execute(WithResources, Runnable)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classWithResources.None
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default WithResourcesand(WithResources withResources)static WithResourcesand(WithResources first, WithResources second)Closeableget()Instantiate any necessary resourcesdefault booleanisNoOp()A convenience method to avoid unnecessary work.static WithResourcesnone()
-
-
-
Method Detail
-
get
Closeable get()
Instantiate any necessary resources- Returns:
- an object that closes any instantiated resources
-
isNoOp
default boolean isNoOp()
A convenience method to avoid unnecessary work.- Returns:
- true iff this object performs no work when
get()is invoked, nor whenCloseable.close()is invoked on the object it returns.
-
and
default WithResources and(WithResources withResources)
-
none
static WithResources none()
-
and
static WithResources and(WithResources first, WithResources second)
-
-