Package io.confluent.license.util
Class ConvertingFutureCallback<U,T>
java.lang.Object
io.confluent.license.util.ConvertingFutureCallback<U,T>
- Type Parameters:
U- the callback result typeT- the future result type obtained after converting the callback result
- Direct Known Subclasses:
FutureCallback
public abstract class ConvertingFutureCallback<U,T>
extends Object
implements Callback<U>, Future<T>
An abstract implementation of
Callback that also implements the Future interface. This allows for
operations like waiting until the callback is completed via onCompletion(Throwable, Object). The result
from the callback can be converted by concrete implementations of this class before being retrieved via
Future.get().-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
ConvertingFutureCallback
public ConvertingFutureCallback() -
ConvertingFutureCallback
-
-
Method Details
-
convert
-
onCompletion
Description copied from interface:CallbackInvoked upon completion of the operation.- Specified by:
onCompletionin interfaceCallback<U>- Parameters:
error- the error that caused the operation to fail, or null if no error occurredresult- the return value, or null if the operation failed
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<U>
-
isDone
public boolean isDone() -
get
- Specified by:
getin interfaceFuture<U>- Throws:
InterruptedExceptionExecutionException
-
get
public T get(long l, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<U>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-