org.jgroups.blocks
Class UnicastRequest<T>
java.lang.Object
org.jgroups.blocks.Request
org.jgroups.blocks.UnicastRequest<T>
- All Implemented Interfaces:
- java.util.concurrent.Future, RspCollector, Command, NotifyingFuture
public class UnicastRequest<T>
- extends Request
Sends a request to a single target destination
- Author:
- Bela Ban
Fields inherited from class org.jgroups.blocks.Request |
block_for_results, completed, corr, done, GET_ABS_MAJORITY, GET_ALL, GET_FIRST, GET_MAJORITY, GET_N, GET_NONE, listener, lock, log, options, req_id, REQUEST_ID, request_msg, transport |
Method Summary |
T |
get()
|
T |
get(long timeout,
java.util.concurrent.TimeUnit unit)
|
Rsp |
getResult()
|
void |
receiveResponse(java.lang.Object response_value,
Address sender)
Callback (called by RequestCorrelator or Transport). |
protected boolean |
responsesComplete()
|
protected void |
sendRequest()
|
void |
suspect(Address suspected_member)
Callback (called by RequestCorrelator or Transport). |
java.lang.String |
toString()
|
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, modeToString, responsesComplete, setBlockForResults, setListener, setResponseFilter, waitForResults |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
result
protected final Rsp<T> result
target
protected final Address target
UnicastRequest
public UnicastRequest(Message m,
RequestCorrelator corr,
Address target,
RequestOptions options)
- Parameters:
timeout
- Time to wait for responses (ms). A value of <= 0 means wait indefinitely
(e.g. if a suspicion service is available; timeouts are not needed).
UnicastRequest
public UnicastRequest(Message m,
Transport transport,
Address target,
RequestOptions options)
- Parameters:
timeout
- Time to wait for responses (ms). A value of <= 0 means wait indefinitely
(e.g. if a suspicion service is available; timeouts are not needed).
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)
- 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
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
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
getResult
public Rsp getResult()
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-2009 Bela Ban / Red Hat. All Rights Reserved.