org.opennms.protocols.rt
Interface Request<ReqIdT,ReqT extends Request<ReqIdT,ReqT,ReplyT>,ReplyT>

All Superinterfaces:
java.lang.Comparable<java.util.concurrent.Delayed>, java.util.concurrent.Delayed

public interface Request<ReqIdT,ReqT extends Request<ReqIdT,ReqT,ReplyT>,ReplyT>
extends java.util.concurrent.Delayed

A Request intended to be sent via a Messenger. This interfaces only provides for retrieving the id for the request so it can be matched against any replies. It also has methods that are using to indicate if an error has occurred or a timeout has occured.

Author:
brozow

Method Summary
 long getDelay(java.util.concurrent.TimeUnit unit)
          Indicates how many units of time are remaining until this request times out.
 ReqIdT getId()
          Returns the id of this request.
 void processError(java.lang.Throwable t)
          If an error or exception occurs during processing of this request then processError is called with the error or exception object.
 void processResponse(ReplyT reply)
          Tell the request about a reply that come in with matched ids.
 ReqT processTimeout()
          Notify this request that no reply has come in before its timeout has elapsed.
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

getId

ReqIdT getId()
Returns the id of this request. This is is matched against the id of a reply in order to associate replies with requests.


getDelay

long getDelay(java.util.concurrent.TimeUnit unit)
Indicates how many units of time are remaining until this request times out. Please note that this is the time REMAINING not the total timeout time. This method is inherited from Delayed

Specified by:
getDelay in interface java.util.concurrent.Delayed

processResponse

void processResponse(ReplyT reply)
Tell the request about a reply that come in with matched ids. Further processing is left to the request.


processTimeout

ReqT processTimeout()
Notify this request that no reply has come in before its timeout has elapsed. (The timeout is indiciated using the getDelay method). If a retry should be attempted then a new request should be returned that can be retried, otherwise null should be returned.


processError

void processError(java.lang.Throwable t)
If an error or exception occurs during processing of this request then processError is called with the error or exception object.



Copyright © 2009. All Rights Reserved.