Package org.apache.cassandra.utils
Interface WithResources
-
- All Known Implementing Classes:
ExecutorLocals
,WithResources.None
public interface WithResources
A 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 class
WithResources.None
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default WithResources
and(WithResources withResources)
static WithResources
and(WithResources first, WithResources second)
Closeable
get()
Instantiate any necessary resourcesdefault boolean
isNoOp()
A convenience method to avoid unnecessary work.static WithResources
none()
-
-
-
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)
-
-