Platform SDK Java 8.5 API Reference

com.genesyslab.platform.clusterprotocol
Class ClusterProtocolImpl.RequestFutureWrapper

java.lang.Object
  extended by com.genesyslab.platform.clusterprotocol.ClusterProtocolImpl.RequestFutureWrapper
All Implemented Interfaces:
RequestFuture, java.util.concurrent.Future<Message>
Enclosing class:
ClusterProtocolImpl<P extends ClientChannel,B extends ProtocolBuilder<P,B>>

protected class ClusterProtocolImpl.RequestFutureWrapper
extends java.lang.Object
implements RequestFuture


Constructor Summary
ClusterProtocolImpl.RequestFutureWrapper(RequestFuture rqFuture, Protocol protocol)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
          Marks this request as canceled and notifies all waiting threads on it.
 Message get()
          Waits if necessary for the request to complete, and then returns its result.
 Message get(long timeout)
          Waits if necessary for at most the given time for the request to complete, and then returns its result, if available.
 Message get(long timeout, java.util.concurrent.TimeUnit unit)
          Waits if necessary for at most the given time for the request to complete, and then returns its result, if available.
 Message getRequest()
          Returns original request message.
 Message getResponse()
          Waits if necessary for the request to complete, and then returns its result.
 Message getResponse(long timeout)
          Waits if necessary for at most the given time for the request to complete, and then returns its result, if available.
 boolean isCanceled()
          Returns true if this task was canceled before it completed normally.
 boolean isCancelled()
           
 boolean isDone()
          Returns true if this request completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterProtocolImpl.RequestFutureWrapper

public ClusterProtocolImpl.RequestFutureWrapper(RequestFuture rqFuture,
                                                Protocol protocol)
Method Detail

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface java.util.concurrent.Future<Message>

getRequest

public Message getRequest()
Description copied from interface: RequestFuture
Returns original request message.

Specified by:
getRequest in interface RequestFuture
Returns:
request message

isDone

public boolean isDone()
Description copied from interface: RequestFuture
Returns true if this request completed. Completion may be due to incoming message from server carrying the same ReferenceId, cancellation, or timeout - in all of these cases this method will return true.
By the other words, it reflects inverted value to "do we still expect for non-received response from server?".

Note: timeout feature is not enabled for beginRequest() by default.

Specified by:
isDone in interface RequestFuture
Specified by:
isDone in interface java.util.concurrent.Future<Message>
Returns:
true if this request completed

cancel

public boolean cancel(boolean mayInterruptIfRunning)
Description copied from interface: RequestFuture
Marks this request as canceled and notifies all waiting threads on it. This call will have no effect if the task has already completed, already been canceled or timed out.

Parameter mayInterruptIfRunning has no effect here because real request execution is been done on server side and communication protocols usually do not support cancellation queries.

Specified by:
cancel in interface RequestFuture
Specified by:
cancel in interface java.util.concurrent.Future<Message>
Parameters:
mayInterruptIfRunning - not used
Returns:
false if the task could not be canceled, typically because it has already completed normally; true otherwise

get

public Message get()
            throws java.lang.InterruptedException
Description copied from interface: RequestFuture
Waits if necessary for the request to complete, and then returns its result.

Specified by:
get in interface RequestFuture
Specified by:
get in interface java.util.concurrent.Future<Message>
Returns:
Response for the request
Throws:
java.lang.InterruptedException - if thread is interrupted

get

public Message get(long timeout)
            throws java.lang.InterruptedException
Description copied from interface: RequestFuture
Waits if necessary for at most the given time for the request to complete, and then returns its result, if available.

Specified by:
get in interface RequestFuture
Parameters:
timeout - timeout in milliseconds
Returns:
Response for the request or null if timeout
Throws:
java.lang.InterruptedException - if thread is interrupted
See Also:
RequestFuture.get(long, TimeUnit), TimeUnit.MILLISECONDS

get

public Message get(long timeout,
                   java.util.concurrent.TimeUnit unit)
            throws java.lang.InterruptedException
Description copied from interface: RequestFuture
Waits if necessary for at most the given time for the request to complete, and then returns its result, if available.

Specified by:
get in interface RequestFuture
Specified by:
get in interface java.util.concurrent.Future<Message>
Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Returns:
Response for the request or null if timeout
Throws:
java.lang.InterruptedException - if thread is interrupted
See Also:
RequestFuture.get(long, TimeUnit), TimeUnit.MILLISECONDS

isCanceled

public boolean isCanceled()
Description copied from interface: RequestFuture
Returns true if this task was canceled before it completed normally.

Specified by:
isCanceled in interface RequestFuture
Returns:
true if task was canceled before it completed
See Also:
Future.isCancelled()

getResponse

public Message getResponse()
                    throws java.lang.InterruptedException
Description copied from interface: RequestFuture
Waits if necessary for the request to complete, and then returns its result.

Specified by:
getResponse in interface RequestFuture
Returns:
Response for the request
Throws:
java.lang.InterruptedException - if thread is interrupted
See Also:
RequestFuture.get()

getResponse

public Message getResponse(long timeout)
                    throws java.lang.InterruptedException
Description copied from interface: RequestFuture
Waits if necessary for at most the given time for the request to complete, and then returns its result, if available.

Specified by:
getResponse in interface RequestFuture
Parameters:
timeout - timeout in milliseconds
Returns:
Response for the request or null if timeout
Throws:
java.lang.InterruptedException - if thread is interrupted
See Also:
RequestFuture.get(long, TimeUnit), TimeUnit.MILLISECONDS

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.