Class RequestCorrelator.ResponseImpl

  • All Implemented Interfaces:
    Response
    Enclosing class:
    RequestCorrelator

    protected class RequestCorrelator.ResponseImpl
    extends java.lang.Object
    implements Response
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Message req  
      protected long req_id  
    • Constructor Summary

      Constructors 
      Constructor Description
      ResponseImpl​(Message req, long req_id)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void send​(java.lang.Object reply, boolean is_exception)
      Sends a response, usually called from a thread spawned by AsyncRequestHandler#handle(Message,Response)
      void send​(Message reply, boolean is_exception)
      Similar to Response.send(Object,boolean), but passes a message instead of an object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • req_id

        protected final long req_id
    • Constructor Detail

      • ResponseImpl

        public ResponseImpl​(Message req,
                            long req_id)
    • Method Detail

      • send

        public void send​(java.lang.Object reply,
                         boolean is_exception)
        Description copied from interface: Response
        Sends a response, usually called from a thread spawned by AsyncRequestHandler#handle(Message,Response)
        Specified by:
        send in interface Response
        Parameters:
        reply - The reply to be sent back, ie. as result to a synchronous RPC. Can be null, e.g. when the method has a void return type.
        is_exception - If AsyncRequestHandler#handle(Message,Response) threw an exception, it must be caught, returned as the reply and is_exception must be true. If reply is a regular object, is_exception is false
      • send

        public void send​(Message reply,
                         boolean is_exception)
        Description copied from interface: Response
        Similar to Response.send(Object,boolean), but passes a message instead of an object. The message needs to contain the marshalled response, so message creation, setting of flags and marshalling is the responsibility of the caller.

        The reason for this additional method is to give the caller more control over the response message.

        This method may be removed, should we find that it's not really needed

        Specified by:
        send in interface Response
        Parameters:
        reply - The reply message
        is_exception - Whether the payload of this message is an exception or a real reply object