Top Description Inners Fields Constructors Methods
com.oracle.bmc.http.internal

public final Class SyncFutureWaiter

extends Object
implements Executor
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Executor
Imports
java.util.ArrayDeque, .Queue, java.util.concurrent.CompletionException, .CompletionStage, .Executor, java.util.concurrent.locks.Condition, .Lock, .ReentrantLock

Helper class that can wait for the result of some future, and do some work registered through the Executor interface while waiting.

The purpose of this is to make execution of synchronous methods look more synchronous, e.g. stack traces should actually contain the caller.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final Condition
private final Lock
private final Queue<Runnable>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
execute(Runnable
the runnable task
command
)

Implements java.util.concurrent.Executor.execute.

Executes the given command at some time in the future.

public <R> R
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

conditionback to summary
private final Condition condition
lockback to summary
private final Lock lock
tasksback to summary
private final Queue<Runnable> tasks

Constructor Detail

SyncFutureWaiterback to summary
public SyncFutureWaiter()

Method Detail

executeback to summary
public void execute(Runnable command)

Implements java.util.concurrent.Executor.execute.

Doc from java.util.concurrent.Executor.execute.

Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.

Parameters
command:Runnable

the runnable task

Annotations
@Override
listenForResultback to summary
public <R> R listenForResult(CompletionStage<R> stage) throws Throwable
com.oracle.bmc.http.internal back to summary

private Class SyncFutureWaiter.Waiter<R>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private boolean
private Throwable
private R

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
public R
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

completeback to summary
private boolean complete
failureback to summary
private Throwable failure
resultback to summary
private R result

Constructor Detail

Waiterback to summary
private Waiter()

Method Detail

listenForResultback to summary
public void listenForResult(CompletionStage<R> stage)
waitAndWorkback to summary
public R waitAndWork() throws InterruptedException, Throwable