Class NettyConnection

    • Field Detail

      • channel

        protected final io.netty.channel.Channel channel
    • Method Detail

      • getNettyChannel

        public final io.netty.channel.Channel getNettyChannel()
      • setAutoRead

        public final void setAutoRead​(boolean autoRead)
        Description copied from interface: Connection
        This will disable reading from the channel. This is basically the same as blocking the reading.
        Specified by:
        setAutoRead in interface Connection
      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in interface Connection
      • fireReady

        public final void fireReady​(boolean ready)
        Specified by:
        fireReady in interface Connection
      • forceClose

        public final void forceClose()
        Description copied from interface: Connection
        This should close the internal channel without calling any listeners. This is to avoid a situation where the broker is busy writing on an internal thread. This should close the socket releasing any pending threads.
        Specified by:
        forceClose in interface Connection
      • getChannel

        public final io.netty.channel.Channel getChannel()
        This is exposed so users would have the option to look at any data through interceptors
        Returns:
      • close

        public final void close()
        Description copied from interface: Connection
        Closes the connection.
        Specified by:
        close in interface Connection
      • createTransportBuffer

        public ActiveMQBuffer createTransportBuffer​(int size)
        Description copied from interface: Connection
        Create a new ActiveMQBuffer of the given size.
        Specified by:
        createTransportBuffer in interface Connection
        Parameters:
        size - the size of buffer to create
        Returns:
        the new buffer.
      • getID

        public final Object getID()
        Description copied from interface: Connection
        returns the unique id of this wire.
        Specified by:
        getID in interface Connection
        Returns:
        the id
      • checkFlushBatchBuffer

        public final void checkFlushBatchBuffer()
        Description copied from interface: Connection
        Called periodically to flush any data in the batch buffer
        Specified by:
        checkFlushBatchBuffer in interface Connection
      • write

        public final void write​(ActiveMQBuffer buffer)
        Description copied from interface: Connection
        writes the buffer to the connection with no flushing or batching
        Specified by:
        write in interface Connection
        Parameters:
        buffer - the buffer to write
      • write

        public void write​(ActiveMQBuffer buffer,
                          boolean requestFlush)
        Description copied from interface: Connection
        writes the buffer to the connection and if flush is true request to flush the buffer (and any previous un-flushed ones) into the wire.
        Specified by:
        write in interface Connection
        Parameters:
        buffer - the buffer to write
        requestFlush - whether to request flush onto the wire
      • flush

        public void flush()
        Description copied from interface: Connection
        Request to flush any previous written buffers into the wire.
        Specified by:
        flush in interface Connection
      • write

        public final void write​(ActiveMQBuffer buffer,
                                boolean flush,
                                boolean batched)
        Description copied from interface: Connection
        writes the buffer to the connection and if flush is true returns only when the buffer has been physically written to the connection.
        Specified by:
        write in interface Connection
        Parameters:
        buffer - the buffer to write
        flush - whether to flush the buffers onto the wire
        batched - whether the packet is allowed to batched for better performance
      • blockUntilWritable

        public final boolean blockUntilWritable​(long timeout,
                                                TimeUnit timeUnit)
        Description copied from interface: Connection
        Causes the current thread to wait until the connection is writable unless the specified waiting time elapses. The available capacity of the connection could change concurrently hence this method is suitable to perform precise flow-control only in a single writer case, while its precision decrease inversely proportional with the rate and the number of concurrent writers. If the current thread is not allowed to block the timeout will be ignored dependently on the connection type.
        Specified by:
        blockUntilWritable in interface Connection
        Parameters:
        timeout - the maximum time to wait
        timeUnit - the time unit of the timeout argument
        Returns:
        true if the connection is writable, false otherwise
      • write

        public final void write​(ActiveMQBuffer buffer,
                                boolean flush,
                                boolean batched,
                                io.netty.channel.ChannelFutureListener futureListener)
        Description copied from interface: Connection
        writes the buffer to the connection and if flush is true returns only when the buffer has been physically written to the connection.
        Specified by:
        write in interface Connection
        Parameters:
        buffer - the buffer to write
        flush - whether to flush the buffers onto the wire
        batched - whether the packet is allowed to batched for better performance
      • getRemoteAddress

        public final String getRemoteAddress()
        Description copied from interface: Connection
        Returns a string representation of the remote address this connection is connected to.
        Specified by:
        getRemoteAddress in interface Connection
        Returns:
        the remote address
      • getLocalAddress

        public final String getLocalAddress()
        Description copied from interface: Connection
        Returns a string representation of the local address this connection is connected to. This is useful when the server is configured at 0.0.0.0 (or multiple IPs). This will give you the actual IP that's being used.
        Specified by:
        getLocalAddress in interface Connection
        Returns:
        the local address
      • isUsingProtocolHandling

        public final boolean isUsingProtocolHandling()
        Description copied from interface: Connection
        the InVM Connection has some special handling as it doesn't use Netty ProtocolChannel we will use this method Instead of using instanceof
        Specified by:
        isUsingProtocolHandling in interface Connection
        Returns: