public abstract static class AsyncFuture.SyncOperation<RES>
extends java.lang.Object
AsyncFuture.Operation
suitable for AsyncFuture
. User implements
runSync()
method and passes the object returned form asAsyncOperation()
to AsyncFuture
. Immediately after this he must call execute()
method
(because some threads may have already got blocked on AsyncFuture.getSync()
method).
However the user runSync()
method may not be actually called if AsyncFuture
didn't started the operation for some reason.Constructor and Description |
---|
SyncOperation() |
Modifier and Type | Method and Description |
---|---|
AsyncFuture.Operation<RES> |
asAsyncOperation() |
void |
execute()
User must call this method immediately after he passed the object to
AsyncFuture . |
protected abstract RES |
runSync()
Does whatever tasks the operation requires.
|
public void execute() throws MethodIsBlockingException
AsyncFuture
.
Failure to do this may cause that some threads remain blocked waiting for result.MethodIsBlockingException
- as the runSync()
is blockingpublic AsyncFuture.Operation<RES> asAsyncOperation()
AsyncFuture.initializeReference(java.util.concurrent.atomic.AtomicReference<org.eclipse.wst.jsdt.chromium.util.AsyncFuture<T>>, org.eclipse.wst.jsdt.chromium.util.AsyncFuture.Operation<T>)
and
AsyncFuture.reinitializeReference(java.util.concurrent.atomic.AtomicReference<org.eclipse.wst.jsdt.chromium.util.AsyncFuture<T>>, org.eclipse.wst.jsdt.chromium.util.AsyncFuture.Operation<T>)
methods.protected abstract RES runSync() throws MethodIsBlockingException
MethodIsBlockingException
- method may deal with blocking operationsCopyright (c) IBM Corp. and others 2000, 2016. All Rights Reserved.