Class CassandraFutureAdapter<T>
java.lang.Object
org.springframework.data.cassandra.core.cql.util.CassandraFutureAdapter<T>
- Type Parameters:
T
- the result type returned by this Future'sget
method
- All Implemented Interfaces:
Future<T>
,ListenableFuture<T>
Adapts a
CompletableFuture
or CompletionStage
into a Spring ListenableFuture
applying
PersistenceExceptionTranslator
.- Since:
- 3.0
-
Constructor Summary
ConstructorDescriptionCassandraFutureAdapter
(CompletableFuture<T> completableFuture, PersistenceExceptionTranslator exceptionMapper) Create a new adapter for the givenCompletableFuture
.CassandraFutureAdapter
(CompletionStage<T> completionStage, PersistenceExceptionTranslator exceptionMapper) Create a new adapter for the givenCompletionStage
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCallback
(ListenableFutureCallback<? super T> callback) void
addCallback
(SuccessCallback<? super T> successCallback, FailureCallback failureCallback) boolean
cancel
(boolean mayInterruptIfRunning) get()
boolean
boolean
isDone()
-
Constructor Details
-
CassandraFutureAdapter
public CassandraFutureAdapter(CompletionStage<T> completionStage, PersistenceExceptionTranslator exceptionMapper) Create a new adapter for the givenCompletionStage
. -
CassandraFutureAdapter
public CassandraFutureAdapter(CompletableFuture<T> completableFuture, PersistenceExceptionTranslator exceptionMapper) Create a new adapter for the givenCompletableFuture
.
-
-
Method Details
-
addCallback
- Specified by:
addCallback
in interfaceListenableFuture<T>
-
addCallback
public void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback) - Specified by:
addCallback
in interfaceListenableFuture<T>
-
completable
- Specified by:
completable
in interfaceListenableFuture<T>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceFuture<T>
-
isDone
public boolean isDone() -
get
- Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
-
get
public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<T>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-