Interface Request<RequestIdT,​RequestT extends Request<RequestIdT,​RequestT,​ResponseT>,​ResponseT>

  • All Superinterfaces:
    Comparable<Delayed>, Delayed
    All Known Implementing Classes:
    JnaPingRequest, Jni6PingRequest, JniPingRequest

    public interface Request<RequestIdT,​RequestT extends Request<RequestIdT,​RequestT,​ResponseT>,​ResponseT>
    extends 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 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​(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 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​(Throwable t)
        If an error or exception occurs during processing of this request then processError is called with the error or exception object.
      • isProcessed

        boolean isProcessed()
        Returns true if this request has already been processed. This method should return true if and only if one of the process method has been called.