Class RemotingConnectionImpl
java.lang.Object
org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection
org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl
- All Implemented Interfaces:
CoreRemotingConnection,RemotingConnection,BufferHandler
public class RemotingConnectionImpl
extends AbstractRemotingConnection
implements CoreRemotingConnection
-
Field Summary
Fields inherited from class org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection
closeListeners, creationTime, dataReceived, destroyed, executor, failureListeners, transportConnection -
Constructor Summary
ConstructorsConstructorDescriptionRemotingConnectionImpl(PacketDecoder packetDecoder, Connection transportConnection, long blockingCallTimeout, long blockingCallFailoverTimeout, List<Interceptor> incomingInterceptors, List<Interceptor> outgoingInterceptors, Executor connectionExecutor) Create a client side connectionRemotingConnectionImpl(PacketDecoder packetDecoder, Connection transportConnection, List<Interceptor> incomingInterceptors, List<Interceptor> outgoingInterceptors, SimpleString nodeID, Executor connectionExecutor) Create a server side connection -
Method Summary
Modifier and TypeMethodDescriptionbooleanblockUntilWritable(long timeout) voidbufferReceived(Object connectionID, ActiveMQBuffer buffer) called by the remoting connection when a buffer is received.voidclose()voiddestroy()destroys this connection.voiddisconnect(boolean criticalError) Disconnect the connection, closing all channelsvoiddisconnect(String scaleDownNodeID, boolean criticalError) Disconnect the connection, closing all channelsvoiddisconnect(DisconnectReason reason, String targetNodeID, TransportConfiguration targetConnector) Disconnect the connection, closing all channelsvoidendOfBatch(Object connectionID) voidfail(ActiveMQException me, String scaleDownTargetNodeID) called when the underlying connection fails.voidflush()flush all outstanding data from the connection.longgenerate a unique (within this connection) channel idlongReturns the current timeout for blocking calls.longReturns the current timeout for blocking calls).getChannel(long channelID, int confWindowSize) Returns the channel with the channel id specified.intThe client protocol used on the communication.Returns the default security principal.longReturns the next id to be chosen.Returns the name of the protocol for this Remoting Connection.Returns the transfer lock used when transferring connections.booleanisClient()Returns true if theRemotingConnectionis a client, otherwise false.booleanThis will check if reconnects are supported on the protocol and configuration.booleanReturn true if the protocol supports flow control.voidkillMessage(SimpleString nodeID) if slow consumer is killed,send the msessage to client.voidputChannel(long channelID, Channel channel) add the channel with the specified channel idprotected voidbooleanremoveChannel(long channelID) remove the channel with the specified channel idvoidsetChannelVersion(int clientVersion) Sets the client protocol used on the communication.voidsyncIDGeneratorSequence(long id) Resets the id generator used to generate id's.toString()Methods inherited from class org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection
addCloseListener, addFailureListener, asyncFail, callClosingListeners, callFailureListeners, checkDataReceived, createTransportBuffer, fail, getClientID, getCreationTime, getFailureListeners, getID, getLocalAddress, getRemoteAddress, getSubject, getTransportConnection, getTransportLocalAddress, isDestroyed, isWritable, removeCloseListener, removeCloseListeners, removeFailureListener, removeFailureListeners, scheduledFlush, setClientID, setCloseListeners, setFailureListeners, setSubjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection
isBeforeProducerMetricsChanged, isBeforeTwoEighteen, isVersionBeforeAddressChange, isVersionBeforeAsyncResponseChange, isVersionNewFQQN, isVersionSupportClientID, isVersionSupportCommitV2, isVersionSupportConsumerPriority, isVersionSupportRouting, isVersionUsingLongOnPageReplicationMethods inherited from interface org.apache.activemq.artemis.spi.core.protocol.RemotingConnection
addCloseListener, addFailureListener, asyncFail, checkDataReceived, createTransportBuffer, fail, getClientID, getCreationTime, getFailureListeners, getID, getRemoteAddress, getSubject, getTransportConnection, getTransportLocalAddress, isDestroyed, isSameTarget, isWritable, removeCloseListener, removeCloseListeners, removeFailureListener, removeFailureListeners, scheduledFlush, setClientID, setCloseListeners, setFailureListeners, setSubject
-
Constructor Details
-
RemotingConnectionImpl
public RemotingConnectionImpl(PacketDecoder packetDecoder, Connection transportConnection, long blockingCallTimeout, long blockingCallFailoverTimeout, List<Interceptor> incomingInterceptors, List<Interceptor> outgoingInterceptors, Executor connectionExecutor) Create a client side connection -
RemotingConnectionImpl
public RemotingConnectionImpl(PacketDecoder packetDecoder, Connection transportConnection, List<Interceptor> incomingInterceptors, List<Interceptor> outgoingInterceptors, SimpleString nodeID, Executor connectionExecutor) Create a server side connection
-
-
Method Details
-
toString
-
getChannelVersion
public int getChannelVersion()Description copied from interface:CoreRemotingConnectionThe client protocol used on the communication. This will determine if the client has support for certain packet types- Specified by:
getChannelVersionin interfaceCoreRemotingConnection
-
setChannelVersion
public void setChannelVersion(int clientVersion) Description copied from interface:CoreRemotingConnectionSets the client protocol used on the communication. This will determine if the client has support for certain packet types- Specified by:
setChannelVersionin interfaceCoreRemotingConnection
-
getChannel
Description copied from interface:CoreRemotingConnectionReturns the channel with the channel id specified.If it does not exist create it with the confirmation window size.
- Specified by:
getChannelin interfaceCoreRemotingConnection- Parameters:
channelID- the channel idconfWindowSize- the confirmation window size- Returns:
- the channel
-
removeChannel
public boolean removeChannel(long channelID) Description copied from interface:CoreRemotingConnectionremove the channel with the specified channel id- Specified by:
removeChannelin interfaceCoreRemotingConnection- Parameters:
channelID- the channel id- Returns:
- true if removed
-
putChannel
Description copied from interface:CoreRemotingConnectionadd the channel with the specified channel id- Specified by:
putChannelin interfaceCoreRemotingConnection- Parameters:
channelID- the channel idchannel- the channel
-
getIncomingInterceptors
-
getOutgoingInterceptors
-
fail
Description copied from interface:RemotingConnectioncalled when the underlying connection fails.- Specified by:
failin interfaceRemotingConnection- Parameters:
me- the exception that caused the failurescaleDownTargetNodeID- the ID of the node where scale down is targeted
-
close
public void close()- Specified by:
closein interfaceRemotingConnection- Overrides:
closein classAbstractRemotingConnection
-
destroy
public void destroy()Description copied from interface:RemotingConnectiondestroys this connection.- Specified by:
destroyin interfaceRemotingConnection
-
blockUntilWritable
public boolean blockUntilWritable(long timeout) Description copied from interface:CoreRemotingConnection- Specified by:
blockUntilWritablein interfaceCoreRemotingConnection
-
disconnect
public void disconnect(boolean criticalError) Description copied from interface:RemotingConnectionDisconnect the connection, closing all channels- Specified by:
disconnectin interfaceRemotingConnection
-
disconnect
Description copied from interface:RemotingConnectionDisconnect the connection, closing all channels- Specified by:
disconnectin interfaceRemotingConnection
-
disconnect
public void disconnect(DisconnectReason reason, String targetNodeID, TransportConfiguration targetConnector) Description copied from interface:RemotingConnectionDisconnect the connection, closing all channels- Specified by:
disconnectin interfaceRemotingConnection
-
generateChannelID
public long generateChannelID()Description copied from interface:CoreRemotingConnectiongenerate a unique (within this connection) channel id- Specified by:
generateChannelIDin interfaceCoreRemotingConnection- Returns:
- the id
-
syncIDGeneratorSequence
public void syncIDGeneratorSequence(long id) Description copied from interface:CoreRemotingConnectionResets the id generator used to generate id's.- Specified by:
syncIDGeneratorSequencein interfaceCoreRemotingConnection- Parameters:
id- the first id to set it to
-
getIDGeneratorSequence
public long getIDGeneratorSequence()Description copied from interface:CoreRemotingConnectionReturns the next id to be chosen.- Specified by:
getIDGeneratorSequencein interfaceCoreRemotingConnection- Returns:
- the next id to be chosen
-
getTransferLock
Description copied from interface:CoreRemotingConnectionReturns the transfer lock used when transferring connections.- Specified by:
getTransferLockin interfaceCoreRemotingConnection- Returns:
- the transfer lock used when transferring connections
-
isClient
public boolean isClient()Description copied from interface:RemotingConnectionReturns true if theRemotingConnectionis a client, otherwise false.- Specified by:
isClientin interfaceRemotingConnection- Overrides:
isClientin classAbstractRemotingConnection- Returns:
- true if the
RemotingConnectionis a client, otherwise false
-
getBlockingCallTimeout
public long getBlockingCallTimeout()Description copied from interface:CoreRemotingConnectionReturns the current timeout for blocking calls).- Specified by:
getBlockingCallTimeoutin interfaceCoreRemotingConnection- Returns:
- the current timeout for blocking calls)
-
getBlockingCallFailoverTimeout
public long getBlockingCallFailoverTimeout()Description copied from interface:CoreRemotingConnectionReturns the current timeout for blocking calls.- Specified by:
getBlockingCallFailoverTimeoutin interfaceCoreRemotingConnection- Returns:
- the current timeout for blocking calls
-
flush
public void flush()Description copied from interface:RemotingConnectionflush all outstanding data from the connection.- Specified by:
flushin interfaceRemotingConnection- Overrides:
flushin classAbstractRemotingConnection
-
getDefaultActiveMQPrincipal
Description copied from interface:CoreRemotingConnectionReturns the default security principal.- Specified by:
getDefaultActiveMQPrincipalin interfaceCoreRemotingConnection- Returns:
- the default security principal
-
isSupportReconnect
public boolean isSupportReconnect()Description copied from interface:RemotingConnectionThis will check if reconnects are supported on the protocol and configuration. In case it's not supported a connection failure could remove messages right away from pending deliveries.- Specified by:
isSupportReconnectin interfaceRemotingConnection- Overrides:
isSupportReconnectin classAbstractRemotingConnection
-
isSupportsFlowControl
public boolean isSupportsFlowControl()Description copied from interface:RemotingConnectionReturn true if the protocol supports flow control. This is because in some cases we may need to hold message producers in cases like disk full. If the protocol doesn't support it we trash the connection and throw exceptions.- Specified by:
isSupportsFlowControlin interfaceRemotingConnection- Overrides:
isSupportsFlowControlin classAbstractRemotingConnection
-
getProtocolName
Description copied from interface:RemotingConnectionReturns the name of the protocol for this Remoting Connection.- Specified by:
getProtocolNamein interfaceRemotingConnection- Returns:
- the name of the protocol for this Remoting Connection
-
bufferReceived
Description copied from interface:BufferHandlercalled by the remoting connection when a buffer is received.- Specified by:
bufferReceivedin interfaceBufferHandler- Overrides:
bufferReceivedin classAbstractRemotingConnection- Parameters:
connectionID- the connection the buffer was received onbuffer- the buffer to decode
-
endOfBatch
- Specified by:
endOfBatchin interfaceBufferHandler
-
removeAllChannels
protected void removeAllChannels() -
killMessage
Description copied from interface:RemotingConnectionif slow consumer is killed,send the msessage to client.- Specified by:
killMessagein interfaceRemotingConnection- Overrides:
killMessagein classAbstractRemotingConnection
-