org.opennms.protocols.rt
Interface Request<RequestIdT,RequestT extends Request<RequestIdT,RequestT,ResponseT>,ResponseT>

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

public interface Request<RequestIdT,RequestT extends Request<RequestIdT,RequestT,ResponseT>,ResponseT>
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.
 RequestIdT 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.
 boolean processResponse(ResponseT reply)
          Tell the request about a reply that come in with matched ids.
 RequestT 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

RequestIdT 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

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


processTimeout

RequestT 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.