public static class HealthCheckDecoder.HealthCheckFuture extends Object implements RiakFuture<RiakMessage,Void>
Constructor and Description |
---|
HealthCheckFuture() |
Modifier and Type | Method and Description |
---|---|
void |
addListener(RiakFutureListener<RiakMessage,Void> listener)
Add a listener to this RiakFuture.
|
void |
await()
Waits for this RiakFuture to be completed.
|
boolean |
await(long timeout,
TimeUnit unit)
Waits for this RiakFuture to be completed for a set amount of time.
|
boolean |
cancel(boolean mayInterruptIfRunning)
Not supported due to limitations of the Riak API.
|
Throwable |
cause()
Return information about the operation and why it failed.
|
RiakMessage |
get()
Waits for this RiakFuture to be completed if necessary and returns the response if available.
|
RiakMessage |
get(long timeout,
TimeUnit unit)
Waits if necessary for at most the given time for the computation
to complete, and then retrieves its result, if available.
|
RiakMessage |
getNow()
Return the result without blocking or throwing an exception.
|
Void |
getQueryInfo()
Returns information related to the operation performed.
|
boolean |
isCancelled() |
boolean |
isDone() |
boolean |
isSuccess()
Determine if the operation completed successfully.
|
void |
removeListener(RiakFutureListener<RiakMessage,Void> listener)
Remove a listener from this RiakFuture.
|
void |
setException(Throwable e) |
void |
setMessage(RiakMessage m) |
public boolean cancel(boolean mayInterruptIfRunning)
RiakFuture
At present time there is no way to cancel an operation sent to Riak. This method will never succeed and always return false.
cancel
in interface RiakFuture<RiakMessage,Void>
cancel
in interface Future<RiakMessage>
public boolean isCancelled()
isCancelled
in interface RiakFuture<RiakMessage,Void>
isCancelled
in interface Future<RiakMessage>
public boolean isDone()
isDone
in interface RiakFuture<RiakMessage,Void>
isDone
in interface Future<RiakMessage>
public RiakMessage get() throws InterruptedException, ExecutionException
RiakFuture
get
in interface RiakFuture<RiakMessage,Void>
get
in interface Future<RiakMessage>
InterruptedException
- if the current thread was interrupted
while waitingExecutionException
- if the computation threw an
exceptionpublic RiakMessage get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
RiakFuture
Note that the timeout value here is how long you are willing to wait for this RiakFuture to complete. If you wish to set a timeout on the command itself, use the timeout() method provided in the command's associated builder.
get
in interface RiakFuture<RiakMessage,Void>
get
in interface Future<RiakMessage>
timeout
- the amount of time to wait before returning.unit
- the unit of time.InterruptedException
- if the current thread was interrupted
while waiting.ExecutionException
- if the computation threw an
exception.TimeoutException
- if the wait timed out.public void setException(Throwable e)
public void setMessage(RiakMessage m)
public void await() throws InterruptedException
RiakFuture
Upon returning, the operation has completed. Checking isSuccess() tells you if it did so successfully.
await
in interface RiakFuture<RiakMessage,Void>
InterruptedException
- if the current thread was interrupted
while waitingRiakFuture.isSuccess()
public boolean await(long timeout, TimeUnit unit) throws InterruptedException
RiakFuture
Note that the timeout value here is how long you are willing to wait for this RiakFuture to complete. Upon return you can check isDone() to see if the future has completed yet or not. The operation is still in progress if that returns false.
If you wish to set a timeout on the command itself, use the timeout() method provided in the command's associated builder.
await
in interface RiakFuture<RiakMessage,Void>
timeout
- the amount of time to wait before returning.unit
- the unit of time.true
if the future completed and false
if the waiting time elapsed before it completedInterruptedException
- if the current thread was interrupted
while waitingRiakFuture.isDone()
,
RiakFuture.isSuccess()
public RiakMessage getNow()
RiakFuture
RiakFuture.isDone()
and not rely on the returned null value.getNow
in interface RiakFuture<RiakMessage,Void>
RiakFuture.isDone()
,
RiakFuture.isSuccess()
public boolean isSuccess()
RiakFuture
isSuccess
in interface RiakFuture<RiakMessage,Void>
public Throwable cause()
RiakFuture
Note this will return null if the operation completed successfully.
cause
in interface RiakFuture<RiakMessage,Void>
RiakFuture.isSuccess()
public Void getQueryInfo()
RiakFuture
Useful in async operations when you want to know what operation this future refers to.
getQueryInfo
in interface RiakFuture<RiakMessage,Void>
public void addListener(RiakFutureListener<RiakMessage,Void> listener)
RiakFuture
addListener
in interface RiakFuture<RiakMessage,Void>
listener
- a RiakFutureListener that will be notified when this RiakFuture completes.public void removeListener(RiakFutureListener<RiakMessage,Void> listener)
RiakFuture
removeListener
in interface RiakFuture<RiakMessage,Void>
listener
- The listener to remove.Copyright © 2016. All rights reserved.