public final class NAsyncOperation<V> extends NObject implements Future<V>
NObject.FromHandle, NObject.NObjectCallback, NObject.NObjectPropertyChangedCallbackchangedCallback, changingCallback, FLAG_REF_RET, propertyChangedCallback, stateChangedCallback| Modifier and Type | Method and Description |
|---|---|
void |
addCompletedListener(ChangeListener listener)
Adds user specified listener for completed event.
|
boolean |
cancel(boolean mayInterruptIfRunning)
Cancels the asycnhronous operation.
|
static <V> NAsyncOperation<V> |
fromHandle(HNObject hAsyncOperation)
Creates a new async operation with the specified return value type from a regular async operation.
|
V |
get()
Waits for the async operation to complete.
|
V |
get(long timeout,
TimeUnit unit)
Waits for the async operation to complete or until the wait period times out.
|
Throwable |
getError()
Retrieves the exception thrown by the async operation.
|
NAsyncStatus |
getStatus()
Retrieves the status of the async operation.
|
boolean |
isCancelled()
Checks whether thea async opertation has been canceled.
|
boolean |
isDone()
Checks whether thea async opertation has been completed.
|
boolean |
isFaulted()
Checks whether thea async opertation has been faulted.
|
static NType |
nativeTypeOf()
Retrieves the native type for the enclosing class.
|
void |
removeCompletedListener(ChangeListener listener)
Removes listener for completed event.
|
addListener, addPropertyChangeListener, captureProperties, claimHandle, clone, compareTo, copyProperties, dispose, disposeArray, equals, fromHandle, fromHandle, fromObject, getFlags, getHandle, getNativeType, getOwner, getProperty, getProperty, getSize, getSize, getSizeMany, getSizeMany, hashCode, invoke, invoke, invoke, isDisposed, nObjectCallbackNativeTypeOf, nObjectPropertyChangedCallbackNativeTypeOf, ref, removeListener, removePropertyChangeListener, reset, resetProperty, save, save, save, save, save, save, save, save, save, save, save, save, saveMany, saveMany, saveMany, saveMany, saveMany, saveMany, saveMany, saveMany, saveMany, saveMany, saveMany, saveMany, setFlags, setProperty, setProperty, toHandle, toObject, toString, toString, unref, unrefArray, unrefElementscheck, dispose, finalizepublic static <V> NAsyncOperation<V> fromHandle(HNObject hAsyncOperation)
hAsyncOperation - A regular async operation.public static NType nativeTypeOf()
public boolean cancel(boolean mayInterruptIfRunning)
public V get() throws InterruptedException, ExecutionException
get in interface Future<V>InterruptedExceptionExecutionExceptionpublic V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<V>timeout - The length of the timeout period.unit - Time unit the timeout is measured in.InterruptedExceptionExecutionExceptionTimeoutExceptionpublic final NAsyncStatus getStatus()
public boolean isDone()
public boolean isCancelled()
isCancelled in interface Future<V>public boolean isFaulted()
public Throwable getError()
public void addCompletedListener(ChangeListener listener)
listener - User specified listener.public void removeCompletedListener(ChangeListener listener)
listener - User specified listener to remove.Copyright © 2016 Neurotechnology. All rights reserved.