org.apache.cassandra.streaming

## Class ConnectionHandler

- java.lang.Object
- - org.apache.cassandra.streaming.ConnectionHandler

-     public class ConnectionHandler
      extends java.lang.Object

  ConnectionHandler manages incoming/outgoing message exchange for the `StreamSession`.

  Internally, ConnectionHandler manages thread to receive incoming `StreamMessage` and thread to send outgoing message. Messages are encoded/decoded on those thread and handed to `StreamSession.messageReceived(org.apache.cassandra.streaming.messages.StreamMessage)`.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `com.google.common.util.concurrent.ListenableFuture<?>` | `close()`
    `com.google.common.util.concurrent.ListenableFuture<?>` | `closeIncoming()`
    `com.google.common.util.concurrent.ListenableFuture<?>` | `closeOutgoing()`
    `void` | `initiate()` Set up incoming message handler and initiate streaming.
    `void` | `initiateOnReceivingSide(IncomingStreamingConnection connection, boolean isForOutgoing, int version)` Set up outgoing message handler on receiving side.
    `boolean` | `isOutgoingConnected()`
    `void` | `sendMessage(StreamMessage message)`
    `void` | `sendMessages(java.util.Collection<? extends StreamMessage> messages)` Enqueue messages to be sent.

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

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

- - ### Method Detail

    - #### initiate

          public void initiate()
                        throws java.io.IOException

      Set up incoming message handler and initiate streaming. This method is called once on initiator.
      Throws:
        `java.io.IOException`

    - #### initiateOnReceivingSide

          public void initiateOnReceivingSide(IncomingStreamingConnection connection,
                                              boolean isForOutgoing,
                                              int version)
                                       throws java.io.IOException

      Set up outgoing message handler on receiving side.
      Parameters:
        `connection` - Incoming connection to use for `OutgoingMessageHandler`.
        `version` - Streaming message version
      Throws:
        `java.io.IOException`

    - #### close

          public com.google.common.util.concurrent.ListenableFuture<?> close()

    - #### closeOutgoing

          public com.google.common.util.concurrent.ListenableFuture<?> closeOutgoing()

    - #### closeIncoming

          public com.google.common.util.concurrent.ListenableFuture<?> closeIncoming()

    - #### sendMessages

          public void sendMessages(java.util.Collection<? extends StreamMessage> messages)

      Enqueue messages to be sent.
      Parameters:
        `messages` - messages to send

    - #### sendMessage

          public void sendMessage(StreamMessage message)

    - #### isOutgoingConnected

          public boolean isOutgoingConnected()

      Returns:
        true if outgoing connection is opened and ready to send messages

Copyright © 2018 The Apache Software Foundation