Top Description Fields Constructors Methods
com.oracle.bmc.waiter.internal

public Class SimpleWaiterImpl<REQUEST, RESPONSE>

extends Object
implements Waiter<REQUEST, RESPONSE>
Class Inheritance
All Implemented Interfaces
com.oracle.bmc.waiter.Waiter
Type Parameters
<REQUEST>
The request type.
<RESPONSE>
The response type.
Imports
java.util.concurrent.Callable, .ExecutorService, .Future, com.oracle.bmc.responses.AsyncHandler, com.oracle.bmc.waiter.Waiter

SimpleWaiterImpl is a basic wrapper around a Callable that executes an action, and provides methods to either execute it synchronously or asynchronously.

Field Summary

Modifier and TypeField and Description
private final Callable<RESPONSE>
callable

The callable to invoke.

private final ExecutorService
executorService

The executor service to submit async requests to.

private final REQUEST
request

The request this waiter is being invoked on.

Constructor Summary

AccessConstructor and Description
public
SimpleWaiterImpl(final ExecutorService executorService, final Callable<RESPONSE> callable, final REQUEST request)

Method Summary

Modifier and TypeMethod and Description
public RESPONSE
execute()

Implements com.oracle.bmc.waiter.Waiter.execute.

Executes the waiter callback and blocks until it either returns or throws an exception.

public Future<Void>
execute(final AsyncHandler<REQUEST, RESPONSE>
The async handler to call, must not be null.
asyncHandler
)

Implements com.oracle.bmc.waiter.Waiter.execute.

Executes the waiter callback and returns a Future.

public REQUEST
getRequest()

The request this waiter is being invoked on.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callableback to summary
private final Callable<RESPONSE> callable

The callable to invoke.

executorServiceback to summary
private final ExecutorService executorService

The executor service to submit async requests to.

requestback to summary
private final REQUEST request

The request this waiter is being invoked on.

Constructor Detail

SimpleWaiterImplback to summary
public SimpleWaiterImpl(final ExecutorService executorService, final Callable<RESPONSE> callable, final REQUEST request)
Annotations
@java.beans.ConstructorProperties

Method Detail

executeback to summary
public RESPONSE execute() throws Exception

Implements com.oracle.bmc.waiter.Waiter.execute.

Doc from com.oracle.bmc.waiter.Waiter.execute.

Executes the waiter callback and blocks until it either returns or throws an exception.

Returns:RESPONSE

The response.

Annotations
@Override
Exceptions
Exception:
If the waiter timed out.
executeback to summary
public Future<Void> execute(final AsyncHandler<REQUEST, RESPONSE> asyncHandler)

Implements com.oracle.bmc.waiter.Waiter.execute.

Doc from com.oracle.bmc.waiter.Waiter.execute.

Executes the waiter callback and returns a Future. The Future will not contain an information. The provided handler will be invoked with either the successful response instance, or the exception thrown in case of failure.

Parameters
asyncHandler:AsyncHandler<REQUEST, RESPONSE>

The async handler to call, must not be null.

Returns:Future<Void>

A Future for the submitted request.

Annotations
@Override
getRequestback to summary
public REQUEST getRequest()

The request this waiter is being invoked on.