com.h3c.util.net.msg

## Class QueuedConversation

- java.lang.Object
- - com.h3c.util.net.msg.Conversation
  - - com.h3c.util.net.msg.QueuedConversation

-     public abstract class QueuedConversation
      extends Conversation

  Conversation capable of accepting messages in one thread and processing them in potentially another thread.

  Derivatives need to provide an executor, via getExecutor() method, and processing logic, via processMessage() method. If messages need to be processed in the same order as they are accepted, it is up to the derivative to supply an executor that will execute processing sequentially.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `QueuedConversation(String topic, int id, int parentId, Executor executor)` Create a new queued dispatch conversation with the supplied id and topic.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `acceptMessage(byte[] message)` Accept a byte form of a message in the context of a given conversation.
    `Executor` | `executor()` Get the executor to be used for processing messages.
    `List<Throwable>` | `getProcessingErrors()` Return the list of errors intercepted as part of asynchronous message processing.
    `abstract void` | `processMessage(byte[] message)` Process message, possibly asynchronously in the context of the executor supplied by getExecutor() method.

    - ### Methods inherited from class com.h3c.util.net.msg.Conversation

      `connection, equals, hashCode, id, isEnded, parentId, setConnection, topic`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### QueuedConversation

          protected QueuedConversation(String topic,
                            int id,
                            int parentId,
                            Executor executor)

      Create a new queued dispatch conversation with the supplied id and topic.
      Parameters:
        `topic` - conversation topic
        `id` - unique conversation id
        `parentId` - unique conversation id of the parent conversation; 0 if no parent conversation
        `executor` - executor for processing messages

  - ### Method Detail

    - #### acceptMessage

          public final void acceptMessage(byte[] message)

      Description copied from class: `Conversation`
      Accept a byte form of a message in the context of a given conversation.
      Specified by:
        `acceptMessage` in class `Conversation`
      Parameters:
        `message` - byte buffer containing the raw message

    - #### executor

          public Executor executor()

      Get the executor to be used for processing messages.
      Returns:
        executor for processing messages

    - #### processMessage

          public abstract void processMessage(byte[] message)

      Process message, possibly asynchronously in the context of the executor supplied by getExecutor() method.
      Parameters:
        `message` - message to be processed

    - #### getProcessingErrors

          public List<Throwable> getProcessingErrors()

      Return the list of errors intercepted as part of asynchronous message processing.
      Returns:
        list of intercepted throwables

Copyright © 2014. All Rights Reserved.