S - the type of service stubspublic class AsyncProxyDelegate<S> extends Object implements ProxyDelegate<S>
ProxyDelegate that delivers the outcome of Calls asynchronously, either through polling or
notifications.
The delegates use ExecutorServices to make calls in separate threads. If required, clients may provide their own
ExecutorServices at the point of call submission.
| Constructor and Description |
|---|
AsyncProxyDelegate(ProxyDelegate<S> delegate)
Creates an instance with a (synchronous)
ProxyDelegate |
| Modifier and Type | Method and Description |
|---|---|
ProxyConfig<?,S> |
config()
Returns the configuration of the proxy.
|
<V> V |
make(Call<S,V> call)
Makes a
Call to a given service endpoint. |
<V> Future<V> |
makeAsync(Call<S,V> call)
|
<V> Future<?> |
makeAsync(Call<S,V> call,
Callback<V> callback)
|
<V> Future<?> |
makeAsync(Call<S,V> call,
Callback<V> callback,
ExecutorService service)
|
<V> Future<V> |
makeAsync(Call<S,V> call,
ExecutorService service)
|
public AsyncProxyDelegate(ProxyDelegate<S> delegate)
ProxyDelegatedelegate - the delegatepublic <V> V make(Call<S,V> call) throws Exception
ProxyDelegateCall to a given service endpoint.make in interface ProxyDelegate<S>V - the type of the value returned from the callcall - the callException - if the call failspublic ProxyConfig<?,S> config()
ProxyDelegateconfig in interface ProxyDelegate<S>public <V> Future<V> makeAsync(Call<S,V> call) throws RejectedExecutionException
Call to a service endpoint asynchronously, returning a Future that clients can use to
poll for and obtain the call outcome, or to cancel the call (assuming that the call is designed for cancellation
or has not been made yet).V - the type of the value returned from the Callcall - the Call to be made asynchronouslyFuture of the Call outcomeRejectedExecutionException - if the call cannot not be submitted for asynchronous executionpublic <V> Future<V> makeAsync(Call<S,V> call, ExecutorService service) throws RejectedExecutionException
Call to a service endpoint asynchronously, returning a Future that clients can use to
poll for and obtain the call outcome, or to cancel the call (assuming that the call is designed for cancellation
or has not been made yet).V - the type of the value returned from the Callcall - the Call to be executed asynchronouslyservice - a ExecutorService to which the Call should be submitted for executionFuture of the Call outcomeRejectedExecutionException - if the call cannot not be submitted for asynchronous executionpublic <V> Future<?> makeAsync(Call<S,V> call, Callback<V> callback) throws RejectedExecutionException
Call to a service endpoint asynchronously, notifying a Callback of its outcome. Returns a
Future that clients can use to cancel the execution of the call (assuming that the call is designed for
cancellation or has not been made yet).call - the Callcallback - the CallbackFuture of call submissionRejectedExecutionException - if the call cannot not be submitted for asynchronous executionpublic <V> Future<?> makeAsync(Call<S,V> call, Callback<V> callback, ExecutorService service) throws RejectedExecutionException
Call to a service endpoint asynchronously, notifying a Callback of its outcome. Returns a
Future that clients can use to cancel the execution of the call (assuming that the call is designed for
cancellation or has not been made yet).call - the Callcallback - the Callbackservice - the ExecutorService that executes the callFuture of call submissionRejectedExecutionException - if the call cannot not be submitted for asynchronous executionCopyright © 2017. All Rights Reserved.