Class Response<T>

  • Type Parameters:
    T - the type of the repsonse.

    public class Response<T>
    extends java.lang.Object
    Encapsulates a (delayed) response from the remote CLB board.
    • Field Detail

      • NO_RESULT

        public static final java.lang.Object NO_RESULT
      • id

        public final int id
      • type

        public final int type
      • user

        public final java.lang.Object user
      • createTime

        public final long createTime
    • Constructor Detail

      • Response

        public Response​(MessageDecoder<T> decoder,
                        MessageProcessor messageProcessor,
                        int id,
                        int type,
                        java.lang.Object user)
        Create a new response.
        Parameters:
        decoder - The decoder used to decode the message into an object or value.
        user - Custom user object
        id - The ID of the transaction
        messageProcessor - The message processor
    • Method Detail

      • isCompleted

        public boolean isCompleted()
        Returns whether or not the response is complete.
        Returns:
        true - Response complete, has value, false - Response net complete
      • hasException

        public boolean hasException()
      • isLost

        public boolean isLost()
      • poll

        public T poll()
      • pollAny

        public java.lang.Object pollAny()
      • context

        public MessageContext context()
        Returns the message context of the response.
      • decodeError

        protected ResponseException decodeError​(MessageContext ctx,
                                                MessageReader mr)
        Decodes an error into an exception
        Parameters:
        mr - Message reader containing the body of the message.
        Returns:
        The decoded exception.
      • get

        public T get()
              throws CommandException
        Gets the object from the response. If no response has yet been received this will wait for it. It will also flush the Control's batched commands.
        Returns:
        The return value.
        Throws:
        ResponseException - When the command executed failed on the remote side.
        CommandException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object