public class NettyConnection extends Object implements Connection
| Modifier and Type | Field and Description |
|---|---|
protected io.netty.channel.Channel |
channel |
| Constructor and Description |
|---|
NettyConnection(Map<String,Object> configuration,
io.netty.channel.Channel channel,
BaseConnectionLifeCycleListener<?> listener,
boolean batchingEnabled,
boolean directDeliver) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
blockUntilWritable(int requiredCapacity,
long timeout,
TimeUnit timeUnit)
Causes the current thread to wait until the connection can enqueue the required capacity unless the specified waiting time elapses.
|
void |
checkFlushBatchBuffer()
Called periodically to flush any data in the batch buffer
|
void |
close()
Closes the connection.
|
ActiveMQBuffer |
createTransportBuffer(int size)
Create a new ActiveMQBuffer of the given size.
|
void |
fireReady(boolean ready) |
void |
forceClose()
This should close the internal channel without calling any listeners.
|
io.netty.channel.Channel |
getChannel()
This is exposed so users would have the option to look at any data through interceptors
|
TransportConfiguration |
getConnectorConfig()
Generates a
TransportConfiguration to be used to connect to the same target this is
connected to. |
ActiveMQPrincipal |
getDefaultActiveMQPrincipal() |
Object |
getID()
returns the unique id of this wire.
|
String |
getLocalAddress()
Returns a string representation of the local address this connection is connected to.
|
io.netty.channel.Channel |
getNettyChannel() |
RemotingConnection |
getProtocolConnection() |
String |
getRemoteAddress()
Returns a string representation of the remote address this connection is connected to.
|
boolean |
isDirectDeliver() |
boolean |
isOpen() |
boolean |
isSameTarget(TransportConfiguration... configs) |
boolean |
isUsingProtocolHandling()
the InVM Connection has some special handling as it doesn't use Netty ProtocolChannel
we will use this method Instead of using instanceof
|
boolean |
isWritable(ReadyListener callback) |
int |
pendingWritesOnChannel() |
void |
setAutoRead(boolean autoRead)
This will disable reading from the channel.
|
void |
setProtocolConnection(RemotingConnection protocolConnection) |
String |
toString() |
void |
write(ActiveMQBuffer buffer)
writes the buffer to the connection with no flushing or batching
|
void |
write(ActiveMQBuffer buffer,
boolean requestFlush)
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.
|
void |
write(ActiveMQBuffer buffer,
boolean flush,
boolean batched)
writes the buffer to the connection and if flush is true returns only when the buffer has been physically written to the connection.
|
void |
write(ActiveMQBuffer buffer,
boolean flush,
boolean batched,
io.netty.channel.ChannelFutureListener futureListener)
writes the buffer to the connection and if flush is true returns only when the buffer has been physically written to the connection.
|
public NettyConnection(Map<String,Object> configuration, io.netty.channel.Channel channel, BaseConnectionLifeCycleListener<?> listener, boolean batchingEnabled, boolean directDeliver)
public final int pendingWritesOnChannel()
public final io.netty.channel.Channel getNettyChannel()
public final void setAutoRead(boolean autoRead)
ConnectionsetAutoRead in interface Connectionpublic final boolean isWritable(ReadyListener callback)
isWritable in interface Connectionpublic boolean isOpen()
isOpen in interface Connectionpublic final void fireReady(boolean ready)
fireReady in interface Connectionpublic final void forceClose()
ConnectionforceClose in interface Connectionpublic final io.netty.channel.Channel getChannel()
public final RemotingConnection getProtocolConnection()
getProtocolConnection in interface Connectionpublic final void setProtocolConnection(RemotingConnection protocolConnection)
setProtocolConnection in interface Connectionpublic final void close()
Connectionclose in interface Connectionpublic ActiveMQBuffer createTransportBuffer(int size)
ConnectioncreateTransportBuffer in interface Connectionsize - the size of buffer to createpublic final Object getID()
ConnectiongetID in interface Connectionpublic final void checkFlushBatchBuffer()
ConnectioncheckFlushBatchBuffer in interface Connectionpublic final void write(ActiveMQBuffer buffer)
Connectionwrite in interface Connectionbuffer - the buffer to writepublic void write(ActiveMQBuffer buffer, boolean requestFlush)
Connectionwrite in interface Connectionbuffer - the buffer to writerequestFlush - whether to request flush onto the wirepublic final void write(ActiveMQBuffer buffer, boolean flush, boolean batched)
Connectionwrite in interface Connectionbuffer - the buffer to writeflush - whether to flush the buffers onto the wirebatched - whether the packet is allowed to batched for better performancepublic final boolean blockUntilWritable(int requiredCapacity,
long timeout,
TimeUnit timeUnit)
ConnectionblockUntilWritable in interface ConnectionrequiredCapacity - the capacity in bytes to be enqueuedtimeout - the maximum time to waittimeUnit - the time unit of the timeout argumenttrue if the connection can enqueue requiredCapacity bytes, false otherwisepublic final void write(ActiveMQBuffer buffer, boolean flush, boolean batched, io.netty.channel.ChannelFutureListener futureListener)
Connectionwrite in interface Connectionbuffer - the buffer to writeflush - whether to flush the buffers onto the wirebatched - whether the packet is allowed to batched for better performancepublic final String getRemoteAddress()
ConnectiongetRemoteAddress in interface Connectionpublic final String getLocalAddress()
ConnectiongetLocalAddress in interface Connectionpublic final boolean isDirectDeliver()
isDirectDeliver in interface Connectionpublic final ActiveMQPrincipal getDefaultActiveMQPrincipal()
getDefaultActiveMQPrincipal in interface Connectionpublic final TransportConfiguration getConnectorConfig()
ConnectionTransportConfiguration to be used to connect to the same target this is
connected to.getConnectorConfig in interface Connectionpublic final boolean isUsingProtocolHandling()
ConnectionisUsingProtocolHandling in interface Connectionpublic boolean isSameTarget(TransportConfiguration... configs)
isSameTarget in interface ConnectionCopyright © 2021 JBoss by Red Hat. All rights reserved.