T - The type the operation returnsU - The protocol type returnedS - Query info typepublic abstract class FutureOperation<T,U,S> extends Object implements RiakFuture<T,S>
| Constructor and Description |
|---|
FutureOperation() |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(RiakFutureListener<T,S> listener)
Add a listener to this RiakFuture.
|
void |
await()
Waits for this RiakFuture to be completed.
|
void |
await(long timeout,
TimeUnit unit)
Waits for this RiakFuture to be completed, or times out.
|
boolean |
cancel(boolean mayInterruptIfRunning) |
Throwable |
cause()
Return information about the operation and why it failed.
|
Object |
channelMessage() |
protected abstract T |
convert(List<U> rawResponse) |
protected abstract RiakMessage |
createChannelMessage() |
protected abstract U |
decode(RiakMessage rawMessage) |
protected boolean |
done(U message)
Detect when the streaming operation is finished
|
T |
get() |
T |
get(long timeout,
TimeUnit unit) |
abstract S |
getQueryInfo()
Returns information related to the operation performed.
|
boolean |
isCancelled() |
boolean |
isDone() |
boolean |
isSuccess()
Determine if the operation was successful.
|
void |
removeListener(RiakFutureListener<T,S> listener)
Remove a listener from this RiakFuture.
|
void |
setResponse(RiakMessage rawResponse) |
public void addListener(RiakFutureListener<T,S> listener)
RiakFutureaddListener in interface RiakFuture<T,S>listener - a FiakFutureListener that will be notified when this RiakFuture completes.public void removeListener(RiakFutureListener<T,S> listener)
RiakFutureremoveListener in interface RiakFuture<T,S>listener - The listener to remove.public final void setResponse(RiakMessage rawResponse)
protected boolean done(U message)
message - raw messagepublic final Object channelMessage()
public final boolean cancel(boolean mayInterruptIfRunning)
public final boolean isCancelled()
isCancelled in interface RiakFuture<T,S>isCancelled in interface Future<T>public final boolean isDone()
public final boolean isSuccess()
RiakFutureisSuccess in interface RiakFuture<T,S>public final Throwable cause()
RiakFuturecause in interface RiakFuture<T,S>public final T get() throws InterruptedException
get in interface RiakFuture<T,S>get in interface Future<T>InterruptedExceptionpublic final T get(long timeout, TimeUnit unit) throws InterruptedException
get in interface RiakFuture<T,S>get in interface Future<T>InterruptedExceptionpublic final void await()
throws InterruptedException
RiakFutureawait in interface RiakFuture<T,S>InterruptedExceptionpublic final void await(long timeout,
TimeUnit unit)
throws InterruptedException
RiakFutureawait in interface RiakFuture<T,S>timeout - the amount of time to wait before returning.unit - the unit of time.InterruptedExceptionprotected abstract RiakMessage createChannelMessage()
protected abstract U decode(RiakMessage rawMessage)
public abstract S getQueryInfo()
RiakFutureUseful in async operations when you want to know what operation this future refers to.
getQueryInfo in interface RiakFuture<T,S>Copyright © 2014. All rights reserved.