Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.chromium.sdk.util
Class AsyncFuture.SyncOperation<RES>

    java.lang.Object
      org.chromium.sdk.util.AsyncFuture.SyncOperation<RES>

Enclosing class:
  AsyncFuture<T>

    public abstract static class AsyncFuture.SyncOperation<RES>

extends java.lang.Object

Helper class that presents operation meant to be executed synchronously in the current thread as an asynchronous `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 Summary
`AsyncFuture.SyncOperation()`

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AsyncFuture.SyncOperation

    public AsyncFuture.SyncOperation()

Method Detail

### execute

    public void execute()
                 throws MethodIsBlockingException

  User must call this method immediately after he passed the object to `AsyncFuture`. Failure to do this may cause that some threads remain blocked waiting for result.

  Throws:
    `MethodIsBlockingException` - as the `runSync()` is blocking

### asAsyncOperation

    public AsyncFuture.Operation<RES> asAsyncOperation()

  Returns:
    Operation type suitable for `AsyncFuture.initializeReference(java.util.concurrent.atomic.AtomicReference>, org.chromium.sdk.util.AsyncFuture.Operation)` and `AsyncFuture.reinitializeReference(java.util.concurrent.atomic.AtomicReference>, org.chromium.sdk.util.AsyncFuture.Operation)` methods.

### runSync

    protected abstract RES runSync()
                            throws MethodIsBlockingException

  Does whatever tasks the operation requires. It may also fail with no special precautions.

  Throws:
    `MethodIsBlockingException` - method may deal with blocking operations

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD