org.jgroups.blocks
Class UnicastRequest<T>

java.lang.Object
  extended by org.jgroups.blocks.Request
      extended by org.jgroups.blocks.UnicastRequest<T>
All Implemented Interfaces:
java.util.concurrent.Future, RspCollector, NotifyingFuture

public class UnicastRequest<T>
extends Request

Sends a request to a single target destination

Author:
Bela Ban

Field Summary
protected  int num_received
           
protected  Rsp<T> result
           
protected  Address target
           
 
Fields inherited from class org.jgroups.blocks.Request
block_for_results, completed, corr, done, listener, lock, log, options, req_id, REQUEST_ID, request_msg
 
Constructor Summary
UnicastRequest(Message msg, Address target, RequestOptions options)
           
UnicastRequest(Message msg, RequestCorrelator corr, Address target, RequestOptions options)
           
 
Method Summary
 T get()
           
 T get(long timeout, java.util.concurrent.TimeUnit unit)
           
 Rsp<T> getResult()
           
 T getValue()
           
 void receiveResponse(java.lang.Object response_value, Address sender, boolean is_exception)
          Callback (called by RequestCorrelator or Transport).
 boolean responseReceived()
           
protected  boolean responsesComplete()
           
protected  void sendRequest()
           
 void siteUnreachable(short site)
           
 void suspect(Address suspected_member)
          Callback (called by RequestCorrelator or Transport).
 java.lang.String toString()
           
 void transportClosed()
           
 void viewChange(View new_view)
          If the target address is not a member of the new view, we'll mark the response as not received and unblock the caller of execute()
 
Methods inherited from class org.jgroups.blocks.Request
cancel, checkCompletion, execute, getBlockForResults, getRequestId, getResponsesComplete, isCancelled, isDone, responsesComplete, setBlockForResults, setListener, setResponseFilter, waitForResults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

result

protected final Rsp<T> result

target

protected final Address target

num_received

protected int num_received
Constructor Detail

UnicastRequest

public UnicastRequest(Message msg,
                      RequestCorrelator corr,
                      Address target,
                      RequestOptions options)

UnicastRequest

public UnicastRequest(Message msg,
                      Address target,
                      RequestOptions options)
Method Detail

sendRequest

protected void sendRequest()
                    throws java.lang.Exception
Specified by:
sendRequest in class Request
Throws:
java.lang.Exception

receiveResponse

public void receiveResponse(java.lang.Object response_value,
                            Address sender,
                            boolean is_exception)
Callback (called by RequestCorrelator or Transport). Adds a response to the response table. When all responses have been received, execute() returns.

Specified by:
receiveResponse in interface RspCollector
Specified by:
receiveResponse in class Request

responseReceived

public boolean responseReceived()

suspect

public void suspect(Address suspected_member)
Callback (called by RequestCorrelator or Transport). Report to GroupRequest that a member is reported as faulty (suspected). This method would probably be called when getting a suspect message from a failure detector (where available). It is used to exclude faulty members from the response list.

Specified by:
suspect in interface RspCollector
Specified by:
suspect in class Request

siteUnreachable

public void siteUnreachable(short site)
Specified by:
siteUnreachable in interface RspCollector
Specified by:
siteUnreachable in class Request

viewChange

public void viewChange(View new_view)
If the target address is not a member of the new view, we'll mark the response as not received and unblock the caller of execute()

Specified by:
viewChange in interface RspCollector
Specified by:
viewChange in class Request

transportClosed

public void transportClosed()

getResult

public Rsp<T> getResult()

getValue

public T getValue()
           throws java.util.concurrent.ExecutionException
Throws:
java.util.concurrent.ExecutionException

get

public T get()
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException

get

public T get(long timeout,
             java.util.concurrent.TimeUnit unit)
      throws java.lang.InterruptedException,
             java.util.concurrent.ExecutionException,
             java.util.concurrent.TimeoutException
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException

toString

public java.lang.String toString()
Overrides:
toString in class Request

responsesComplete

protected boolean responsesComplete()
Specified by:
responsesComplete in class Request


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.