Class InVMConnection
java.lang.Object
org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection
- All Implemented Interfaces:
Connection
-
Constructor Summary
ConstructorsConstructorDescriptionInVMConnection(int serverID, String id, BufferHandler handler, BaseConnectionLifeCycleListener listener, ArtemisExecutor executor) InVMConnection(int serverID, String id, BufferHandler handler, BaseConnectionLifeCycleListener listener, ArtemisExecutor executor, ActiveMQPrincipal defaultActiveMQPrincipal) InVMConnection(int serverID, BufferHandler handler, BaseConnectionLifeCycleListener listener, ArtemisExecutor executor) -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled periodically to flush any data in the batch buffervoidclose()Closes the connection.createTransportBuffer(int size) Create a new ActiveMQBuffer of the given size.voidvoidfireReady(boolean ready) voidThis should close the internal channel without calling any listeners.intGenerates aTransportConfigurationto be used to connect to the same target this is connected to.io.netty.channel.EventLoopgetID()Returns the unique id of this wire.Returns a string representation of the local address this connection is connected to.Returns the string representation of the remote address this connection is connected to.booleanbooleanisOpen()booleanisSameTarget(TransportConfiguration... configs) booleanthe InVM Connection has some special handling as it doesn't use Netty ProtocolChannel we will use this method Instead of using instanceofbooleanisWritable(ReadyListener listener) voidsetAutoRead(boolean autoRead) This will disable reading from the channel.voidsetDirectDeliver(boolean directDeliver) voidsetEnableBufferPooling(boolean enableBufferPooling) static voidsetFlushEnabled(boolean enable) voidsetProtocolConnection(RemotingConnection connection) toString()voidwrite(ActiveMQBuffer buffer) writes the buffer to the connection with no flushing or batchingvoidwrite(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.voidwrite(ActiveMQBuffer buffer, boolean flush, boolean batch) writes the buffer to the connection and if flush is true returns only when the buffer has been physically written to the connection.voidwrite(ActiveMQBuffer buffer, boolean flush, boolean batch, 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.spi.core.remoting.Connection
blockUntilWritable, flush, getRouter, getSNIHostName
-
Constructor Details
-
InVMConnection
public InVMConnection(int serverID, BufferHandler handler, BaseConnectionLifeCycleListener listener, ArtemisExecutor executor) -
InVMConnection
public InVMConnection(int serverID, String id, BufferHandler handler, BaseConnectionLifeCycleListener listener, ArtemisExecutor executor) -
InVMConnection
public InVMConnection(int serverID, String id, BufferHandler handler, BaseConnectionLifeCycleListener listener, ArtemisExecutor executor, ActiveMQPrincipal defaultActiveMQPrincipal)
-
-
Method Details
-
setEnableBufferPooling
public void setEnableBufferPooling(boolean enableBufferPooling) -
forceClose
public void forceClose()Description copied from interface:ConnectionThis 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:
forceClosein interfaceConnection
-
isWritable
- Specified by:
isWritablein interfaceConnection
-
isOpen
public boolean isOpen()- Specified by:
isOpenin interfaceConnection
-
fireReady
public void fireReady(boolean ready) - Specified by:
fireReadyin interfaceConnection
-
getProtocolConnection
- Specified by:
getProtocolConnectionin interfaceConnection
-
setProtocolConnection
- Specified by:
setProtocolConnectionin interfaceConnection
-
close
public void close()Description copied from interface:ConnectionCloses the connection.- Specified by:
closein interfaceConnection
-
disconnect
public void disconnect()- Specified by:
disconnectin interfaceConnection
-
setAutoRead
public void setAutoRead(boolean autoRead) Description copied from interface:ConnectionThis will disable reading from the channel. This is basically the same as blocking the reading.- Specified by:
setAutoReadin interfaceConnection
-
createTransportBuffer
Description copied from interface:ConnectionCreate a new ActiveMQBuffer of the given size.- Specified by:
createTransportBufferin interfaceConnection- Parameters:
size- the size of buffer to create- Returns:
- the new buffer
-
getID
Description copied from interface:ConnectionReturns the unique id of this wire.- Specified by:
getIDin interfaceConnection- Returns:
- the unique id of this wire
-
checkFlushBatchBuffer
public void checkFlushBatchBuffer()Description copied from interface:ConnectionCalled periodically to flush any data in the batch buffer- Specified by:
checkFlushBatchBufferin interfaceConnection
-
write
Description copied from interface:Connectionwrites 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:
writein interfaceConnection- Parameters:
buffer- the buffer to writerequestFlush- whether to request flush onto the wire
-
write
Description copied from interface:Connectionwrites the buffer to the connection with no flushing or batching- Specified by:
writein interfaceConnection- Parameters:
buffer- the buffer to write
-
write
Description copied from interface:Connectionwrites the buffer to the connection and if flush is true returns only when the buffer has been physically written to the connection.- Specified by:
writein interfaceConnection- Parameters:
buffer- the buffer to writeflush- whether to flush the buffers onto the wirebatch- whether the packet is allowed to batched for better performance
-
write
public void write(ActiveMQBuffer buffer, boolean flush, boolean batch, io.netty.channel.ChannelFutureListener futureListener) Description copied from interface:Connectionwrites the buffer to the connection and if flush is true returns only when the buffer has been physically written to the connection.- Specified by:
writein interfaceConnection- Parameters:
buffer- the buffer to writeflush- whether to flush the buffers onto the wirebatch- whether the packet is allowed to batched for better performance
-
getEventLoop
public io.netty.channel.EventLoop getEventLoop()- Specified by:
getEventLoopin interfaceConnection
-
getRemoteAddress
Description copied from interface:ConnectionReturns the string representation of the remote address this connection is connected to.- Specified by:
getRemoteAddressin interfaceConnection- Returns:
- the string representation of the remote address this connection is connected to
-
getLocalAddress
Description copied from interface:ConnectionReturns 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:
getLocalAddressin interfaceConnection- Returns:
- the local address
-
getBatchingBufferSize
public int getBatchingBufferSize() -
isUsingProtocolHandling
public boolean isUsingProtocolHandling()Description copied from interface:Connectionthe InVM Connection has some special handling as it doesn't use Netty ProtocolChannel we will use this method Instead of using instanceof- Specified by:
isUsingProtocolHandlingin interfaceConnection
-
getDefaultActiveMQPrincipal
- Specified by:
getDefaultActiveMQPrincipalin interfaceConnection
-
setFlushEnabled
public static void setFlushEnabled(boolean enable) -
getExecutor
-
getConnectorConfig
Description copied from interface:ConnectionGenerates aTransportConfigurationto be used to connect to the same target this is connected to.- Specified by:
getConnectorConfigin interfaceConnection- Returns:
- TransportConfiguration
-
isDirectDeliver
public boolean isDirectDeliver()- Specified by:
isDirectDeliverin interfaceConnection
-
setDirectDeliver
public void setDirectDeliver(boolean directDeliver) -
toString
-
isSameTarget
- Specified by:
isSameTargetin interfaceConnection
-