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 by
Closeable.
See ExecutorPlus.execute(WithResources, Runnable)-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiondefault WithResourcesand(WithResources withResources) static WithResourcesand(WithResources first, WithResources second) get()Instantiate any necessary resourcesdefault booleanisNoOp()A convenience method to avoid unnecessary work.static WithResourcesnone()
-
Method Details
-
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
-
none
-
and
-