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, executor, failureListeners, transportConnection
-
-
Constructor Summary
Constructors Constructor Description RemotingConnectionImpl(PacketDecoder packetDecoder, Connection transportConnection, long blockingCallTimeout, long blockingCallFailoverTimeout, List<Interceptor> incomingInterceptors, List<Interceptor> outgoingInterceptors, Executor connectionExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanblockUntilWritable(long timeout)voidbufferReceived(Object connectionID, ActiveMQBuffer buffer)called by the remoting connection when a buffer is received.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.longgenerateChannelID()generate a unique (within this connection) channel idlonggetBlockingCallFailoverTimeout()Returns the current timeout for blocking callslonggetBlockingCallTimeout()Returns the current timeout for blocking callsChannelgetChannel(long channelID, int confWindowSize)Returns the channel with the channel id specified.intgetChannelVersion()The client protocol used on the communication.ActiveMQPrincipalgetDefaultActiveMQPrincipal()Returns the default security principallonggetIDGeneratorSequence()Returns the next id to be chosen.List<Interceptor>getIncomingInterceptors()List<Interceptor>getOutgoingInterceptors()StringgetProtocolName()Returns the name of the protocol for this Remoting ConnectionObjectgetTransferLock()Returns the transfer lock used when transferring connections.StringgetTransportLocalAddress()Returns a string representation of the local address this connection is connected to.booleanisClient()Returns whether or not theRemotingConnectionis a clientbooleanisDestroyed()Returns true if thisRemotingConnectionhas been destroyed.booleanisSupportReconnect()This will check if reconnects are supported on the protocol and configuration.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 voidremoveAllChannels()booleanremoveChannel(long channelID)remove the channel with the specified channel idvoidscheduledFlush()voidsetChannelVersion(int clientVersion)Sets the client protocol used on the communication.voidsyncIDGeneratorSequence(long id)Resets the id generator used to generate id's.StringtoString()-
Methods inherited from class org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection
addCloseListener, addFailureListener, asyncFail, callClosingListeners, callFailureListeners, checkDataReceived, createTransportBuffer, fail, getAuditSubject, getClientID, getCreationTime, getFailureListeners, getID, getLocalAddress, getRemoteAddress, getSubject, getTransportConnection, isSupportsFlowControl, isWritable, removeCloseListener, removeCloseListeners, removeFailureListener, removeFailureListeners, setAuditSubject, setClientID, setCloseListeners, setFailureListeners
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.protocol.core.CoreRemotingConnection
isBeforeTwoEighteen, isVersionBeforeAddressChange, isVersionBeforeAsyncResponseChange, isVersionNewFQQN, isVersionSupportClientID, isVersionSupportCommitV2, isVersionSupportConsumerPriority, isVersionSupportRouting
-
Methods inherited from interface org.apache.activemq.artemis.spi.core.protocol.RemotingConnection
addCloseListener, addFailureListener, asyncFail, checkDataReceived, createTransportBuffer, fail, getAuditSubject, getClientID, getCreationTime, getFailureListeners, getID, getRemoteAddress, getSubject, getTransportConnection, isSameTarget, isSupportsFlowControl, isWritable, removeCloseListener, removeCloseListeners, removeFailureListener, removeFailureListeners, setAuditSubject, setClientID, setCloseListeners, setFailureListeners
-
-
-
-
Constructor Detail
-
RemotingConnectionImpl
public RemotingConnectionImpl(PacketDecoder packetDecoder, Connection transportConnection, long blockingCallTimeout, long blockingCallFailoverTimeout, List<Interceptor> incomingInterceptors, List<Interceptor> outgoingInterceptors, Executor connectionExecutor)
-
-
Method Detail
-
scheduledFlush
public void scheduledFlush()
- Specified by:
scheduledFlushin interfaceRemotingConnection- Overrides:
scheduledFlushin classAbstractRemotingConnection
-
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- Returns:
- the channelVersion
-
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- Parameters:
clientVersion- the channelVersion to set
-
getChannel
public Channel getChannel(long channelID, int confWindowSize)
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
public void putChannel(long channelID, Channel channel)Description copied from interface:CoreRemotingConnectionadd the channel with the specified channel id- Specified by:
putChannelin interfaceCoreRemotingConnection- Parameters:
channelID- the channel idchannel- the channel
-
getIncomingInterceptors
public List<Interceptor> getIncomingInterceptors()
-
getOutgoingInterceptors
public List<Interceptor> getOutgoingInterceptors()
-
fail
public void fail(ActiveMQException me, String scaleDownTargetNodeID)
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
-
destroy
public void destroy()
Description copied from interface:RemotingConnectiondestroys this connection.- Specified by:
destroyin interfaceRemotingConnection
-
blockUntilWritable
public boolean blockUntilWritable(long timeout)
- Specified by:
blockUntilWritablein interfaceCoreRemotingConnection- Returns:
-
disconnect
public void disconnect(boolean criticalError)
Description copied from interface:RemotingConnectionDisconnect the connection, closing all channels- Specified by:
disconnectin interfaceRemotingConnection
-
disconnect
public void disconnect(String scaleDownNodeID, boolean criticalError)
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 id
-
getTransferLock
public Object getTransferLock()
Description copied from interface:CoreRemotingConnectionReturns the transfer lock used when transferring connections.- Specified by:
getTransferLockin interfaceCoreRemotingConnection- Returns:
- the lock
-
isClient
public boolean isClient()
Description copied from interface:RemotingConnectionReturns whether or not theRemotingConnectionis a client- Specified by:
isClientin interfaceRemotingConnection- Returns:
- true if client, false if a server
-
isDestroyed
public boolean isDestroyed()
Description copied from interface:RemotingConnectionReturns true if thisRemotingConnectionhas been destroyed.- Specified by:
isDestroyedin interfaceRemotingConnection- Returns:
- true if destroyed, otherwise false
-
getBlockingCallTimeout
public long getBlockingCallTimeout()
Description copied from interface:CoreRemotingConnectionReturns the current timeout for blocking calls- Specified by:
getBlockingCallTimeoutin interfaceCoreRemotingConnection- Returns:
- the timeout in milliseconds
-
getBlockingCallFailoverTimeout
public long getBlockingCallFailoverTimeout()
Description copied from interface:CoreRemotingConnectionReturns the current timeout for blocking calls- Specified by:
getBlockingCallFailoverTimeoutin interfaceCoreRemotingConnection- Returns:
- the timeout in milliseconds
-
flush
public void flush()
Description copied from interface:RemotingConnectionflush all outstanding data from the connection.- Specified by:
flushin interfaceRemotingConnection
-
getDefaultActiveMQPrincipal
public ActiveMQPrincipal getDefaultActiveMQPrincipal()
Description copied from interface:CoreRemotingConnectionReturns the default security principal- Specified by:
getDefaultActiveMQPrincipalin interfaceCoreRemotingConnection- Returns:
- the 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- Returns:
-
getProtocolName
public String getProtocolName()
Returns the name of the protocol for this Remoting Connection- Specified by:
getProtocolNamein interfaceRemotingConnection- Returns:
-
bufferReceived
public void bufferReceived(Object connectionID, ActiveMQBuffer buffer)
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
public void endOfBatch(Object connectionID)
- Specified by:
endOfBatchin interfaceBufferHandler
-
getTransportLocalAddress
public String getTransportLocalAddress()
Description copied from interface:RemotingConnectionReturns 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:
getTransportLocalAddressin interfaceRemotingConnection- Returns:
- the local address of transport connection
-
removeAllChannels
protected void removeAllChannels()
-
killMessage
public void killMessage(SimpleString nodeID)
Description copied from interface:RemotingConnectionif slow consumer is killed,send the msessage to client.- Specified by:
killMessagein interfaceRemotingConnection
-
-