public class GridNioFutureImpl<R> extends AbstractQueuedSynchronizer implements GridNioFuture<R>
AbstractQueuedSynchronizer.ConditionObject| Modifier and Type | Field and Description |
|---|---|
protected long |
endTime |
protected boolean |
msgThread |
protected long |
startTime
Future start time.
|
| Constructor and Description |
|---|
GridNioFutureImpl() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancel()
Default no-op implementation that always returns
false. |
protected Throwable |
error() |
R |
get()
Synchronously waits for completion of the operation and
returns operation result.
|
R |
get(long timeout)
Synchronously waits for completion of the operation for
up to the timeout specified and returns operation result.
|
R |
get(long timeout,
TimeUnit unit)
Synchronously waits for completion of the operation for
up to the timeout specified and returns operation result.
|
protected R |
get0(long nanosTimeout) |
boolean |
isCancelled()
Returns
true if this operation was cancelled before it completed normally. |
boolean |
isDone()
Checks if operation is done.
|
void |
listenAsync(IgniteInClosure<? super GridNioFuture<R>> lsnr)
Registers listener closure to be asynchronously notified whenever future completes.
|
boolean |
messageThread() |
void |
messageThread(boolean msgThread)
Sets flag indicating that message send future was created in thread that was processing a message.
|
boolean |
onCancelled()
Callback to notify that future is cancelled.
|
boolean |
onDone()
Callback to notify that future is finished with
null result. |
boolean |
onDone(R res)
Callback to notify that future is finished.
|
boolean |
onDone(R res,
Throwable err)
Callback to notify that future is finished.
|
boolean |
onDone(Throwable err)
Callback to notify that future is finished.
|
protected R |
result() |
boolean |
skipRecovery() |
String |
toString() |
protected int |
tryAcquireShared(int ignore) |
protected boolean |
tryReleaseShared(int ignore) |
acquire, acquireInterruptibly, acquireShared, acquireSharedInterruptibly, compareAndSetState, getExclusiveQueuedThreads, getFirstQueuedThread, getQueuedThreads, getQueueLength, getSharedQueuedThreads, getState, getWaitingThreads, getWaitQueueLength, hasContended, hasQueuedPredecessors, hasQueuedThreads, hasWaiters, isHeldExclusively, isQueued, owns, release, releaseShared, setState, tryAcquire, tryAcquireNanos, tryAcquireSharedNanos, tryReleasegetExclusiveOwnerThread, setExclusiveOwnerThreadprotected final long startTime
protected volatile long endTime
protected boolean msgThread
protected Throwable error()
protected R result()
public R get() throws IOException, IgniteCheckedException
get in interface GridNioFuture<R>IOException - If IOException occurred while performing operation.IgniteInterruptedCheckedException - Subclass of IgniteCheckedException thrown if the wait was interrupted.IgniteFutureCancelledCheckedException - Subclass of IgniteCheckedException throws if operation was cancelled.IgniteCheckedException - If operation failed.public R get(long timeout) throws IOException, IgniteCheckedException
get(long, TimeUnit.MILLISECONDS).get in interface GridNioFuture<R>timeout - The maximum time to wait in milliseconds.IOException - If IOException occurred while performing operation.IgniteInterruptedCheckedException - Subclass of IgniteCheckedException thrown if the wait was interrupted.IgniteFutureTimeoutCheckedException - Subclass of IgniteCheckedException thrown if the wait was timed out.IgniteFutureCancelledCheckedException - Subclass of IgniteCheckedException throws if operation was cancelled.IgniteCheckedException - If operation failed.public R get(long timeout, TimeUnit unit) throws IOException, IgniteCheckedException
get in interface GridNioFuture<R>timeout - The maximum time to wait.unit - The time unit of the timeout argument.IOException - If IOException occurred while performing operation.IgniteInterruptedCheckedException - Subclass of IgniteCheckedException thrown if the wait was interrupted.IgniteFutureTimeoutCheckedException - Subclass of IgniteCheckedException thrown if the wait was timed out.IgniteFutureCancelledCheckedException - Subclass of IgniteCheckedException throws if operation was cancelled.IgniteCheckedException - If operation failed.@Nullable protected R get0(long nanosTimeout) throws InterruptedException, IgniteCheckedException
nanosTimeout - Timeout (nanoseconds).InterruptedException - If interrupted.IgniteFutureTimeoutCheckedException - If timeout reached before computation completed.IgniteCheckedException - If error occurred.public boolean cancel()
throws IgniteCheckedException
false.
Futures that do support cancellation should override this method
and call onCancelled() callback explicitly if cancellation
indeed did happen.cancel in interface GridNioFuture<R>True if future was canceled (i.e. was not finished prior to this call).IgniteCheckedException - If cancellation failed.public boolean isDone()
isDone in interface GridNioFuture<R>True if operation is done, false otherwise.public boolean isCancelled()
true if this operation was cancelled before it completed normally.isCancelled in interface GridNioFuture<R>True if this operation was cancelled before it completed normally.public void listenAsync(@Nullable IgniteInClosure<? super GridNioFuture<R>> lsnr)
listenAsync in interface GridNioFuture<R>lsnr - Listener closure to register. If not provided - this method is no-op.public void messageThread(boolean msgThread)
messageThread in interface GridNioFuture<R>msgThread - True if future was created in thread that is processing message.public boolean messageThread()
messageThread in interface GridNioFuture<R>True if future was created in thread that was processing message.public final boolean onDone()
null result.
This method must delegate to onDone(Object, Throwable) method.True if result was set by this call.public final boolean onDone(@Nullable R res)
onDone(Object, Throwable) method.res - Result.True if result was set by this call.public final boolean onDone(@Nullable Throwable err)
onDone(Object, Throwable) method.err - Error.True if result was set by this call.public boolean onDone(@Nullable R res, @Nullable Throwable err)
null exception is passed in
the result value will be ignored.res - Optional result.err - Optional error.True if result was set by this call.public boolean onCancelled()
True if cancel flag was set by this call.protected final int tryAcquireShared(int ignore)
tryAcquireShared in class AbstractQueuedSynchronizerprotected final boolean tryReleaseShared(int ignore)
tryReleaseShared in class AbstractQueuedSynchronizerpublic boolean skipRecovery()
skipRecovery in interface GridNioFuture<R>True if skip recovery for this operation.public String toString()
toString in class AbstractQueuedSynchronizer
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC1 Release Date : February 17 2015