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,
ConnectionLifeCycleListener listener,
boolean batchingEnabled,
boolean directDeliver) |
Modifier and Type | Method and Description |
---|---|
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 |
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) |
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 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, ConnectionLifeCycleListener listener, boolean batchingEnabled, boolean directDeliver)
public io.netty.channel.Channel getNettyChannel()
public boolean isWritable(ReadyListener callback)
isWritable
in interface Connection
public void fireReady(boolean ready)
fireReady
in interface Connection
public void forceClose()
Connection
forceClose
in interface Connection
public io.netty.channel.Channel getChannel()
public RemotingConnection getProtocolConnection()
getProtocolConnection
in interface Connection
public void setProtocolConnection(RemotingConnection protocolConnection)
setProtocolConnection
in interface Connection
public void close()
Connection
close
in interface Connection
public ActiveMQBuffer createTransportBuffer(int size)
Connection
createTransportBuffer
in interface Connection
size
- the size of buffer to createpublic Object getID()
Connection
getID
in interface Connection
public void checkFlushBatchBuffer()
Connection
checkFlushBatchBuffer
in interface Connection
public void write(ActiveMQBuffer buffer)
Connection
write
in interface Connection
buffer
- the buffer to writepublic void write(ActiveMQBuffer buffer, boolean flush, boolean batched)
Connection
write
in interface Connection
buffer
- the buffer to writeflush
- whether to flush the buffers onto the wirebatched
- whether the packet is allowed to batched for better performancepublic void write(ActiveMQBuffer buffer, boolean flush, boolean batched, io.netty.channel.ChannelFutureListener futureListener)
Connection
write
in interface Connection
buffer
- the buffer to writeflush
- whether to flush the buffers onto the wirebatched
- whether the packet is allowed to batched for better performancepublic String getRemoteAddress()
Connection
getRemoteAddress
in interface Connection
public String getLocalAddress()
Connection
getLocalAddress
in interface Connection
public boolean isDirectDeliver()
public ActiveMQPrincipal getDefaultActiveMQPrincipal()
getDefaultActiveMQPrincipal
in interface Connection
public TransportConfiguration getConnectorConfig()
Connection
TransportConfiguration
to be used to connect to the same target this is
connected to.getConnectorConfig
in interface Connection
public boolean isUsingProtocolHandling()
Connection
isUsingProtocolHandling
in interface Connection
Copyright © 2016 JBoss by Red Hat. All rights reserved.