Class TemporarySelectorWriter

    • Method Detail

      • write

        public void write​(Connection<java.net.SocketAddress> connection,
                          java.net.SocketAddress dstAddress,
                          WritableMessage message,
                          CompletionHandler<WriteResult<WritableMessage,​java.net.SocketAddress>> completionHandler,
                          long timeout,
                          java.util.concurrent.TimeUnit timeunit)
        Method writes the WritableMessage to the specific address.
        Parameters:
        connection - the Connection to write to
        dstAddress - the destination address the message will be sent to
        message - the WritableMessage, from which the data will be written
        completionHandler - CompletionHandler, which will get notified, when write will be completed
      • write0

        protected long write0​(NIOConnection connection,
                              java.net.SocketAddress dstAddress,
                              WritableMessage message,
                              WriteResult<WritableMessage,​java.net.SocketAddress> currentResult,
                              long timeout,
                              java.util.concurrent.TimeUnit timeunit)
                       throws java.io.IOException
        Flush the buffer by looping until the Buffer is empty
        Parameters:
        connection - the Connection.
        dstAddress - the destination address.
        message -
        currentResult - the result of the write operation
        timeout - operation timeout value value
        timeunit - the timeout unit
        Returns:
        The number of bytes written.
        Throws:
        java.io.IOException
      • canWrite

        public boolean canWrite​(Connection connection)
        Return true if the connection has not exceeded it's maximum size in bytes of pending writes, otherwise false.
        Parameters:
        connection - the Connection to test whether or not the specified number of bytes can be written to.
        Returns:
        true if the connection has not exceeded it's maximum size in bytes of pending writes, otherwise false
      • notifyWritePossible

        public void notifyWritePossible​(Connection connection,
                                        WriteHandler writeHandler)
        Registers WriteHandler, which will be notified ones at least one byte can be written. This method call is equivalent to call notifyWritePossible(connection, writeHandler, 1); Note: using this method from different threads simultaneously may lead to quick situation changes, so at time WriteHandler is called - the queue may become busy again.
        Parameters:
        connection - Connection
        writeHandler - WriteHandler to be notified.