public class TransportConnection extends Object implements Connection, org.apache.activemq.thread.Task, org.apache.activemq.state.CommandVisitor
| Modifier and Type | Field and Description |
|---|---|
protected Broker |
broker |
protected Map<org.apache.activemq.command.ConnectionId,org.apache.activemq.state.ConnectionState> |
brokerConnectionStates |
protected org.apache.activemq.command.BrokerInfo |
brokerInfo |
protected BrokerService |
brokerService |
protected TransportConnector |
connector |
protected List<org.apache.activemq.command.Command> |
dispatchQueue |
protected AtomicBoolean |
dispatchStopped |
protected org.apache.activemq.thread.TaskRunner |
taskRunner |
protected AtomicReference<Throwable> |
transportException |
| Constructor and Description |
|---|
TransportConnection(TransportConnector connector,
org.apache.activemq.transport.Transport transport,
Broker broker,
org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory,
org.apache.activemq.thread.TaskRunnerFactory stopTaskRunnerFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
delayedStop(int waitTime,
String reason,
Throwable cause) |
protected void |
dispatch(org.apache.activemq.command.Command command) |
void |
dispatchAsync(org.apache.activemq.command.Command message)
Sends a message to the client.
|
void |
dispatchSync(org.apache.activemq.command.Command message)
Sends a message to the client.
|
void |
doMark()
Mark the Connection, so we can deem if it's collectable on the next sweep
|
protected void |
doStop() |
int |
getActiveTransactionCount()
Returns the number of active transactions established on this Connection.
|
String |
getConnectionId() |
Connector |
getConnector() |
int |
getDispatchQueueSize()
Returns the number of messages to be dispatched to this connection
|
protected String |
getDuplexNetworkConnectorId() |
MessageAuthorizationPolicy |
getMessageAuthorizationPolicy() |
Long |
getOldestActiveTransactionDuration()
Returns the number of active transactions established on this Connection.
|
ProducerBrokerExchange |
getProducerBrokerExchangeIfExists(org.apache.activemq.command.ProducerInfo producerInfo) |
int |
getProtocolVersion() |
String |
getRemoteAddress() |
org.apache.activemq.command.WireFormatInfo |
getRemoteWireFormatInfo() |
ConnectionStatistics |
getStatistics()
Returns the statistics for this connection
|
protected CountDownLatch |
getStopped() |
org.apache.activemq.transport.Transport |
getTransport() |
boolean |
isActive() |
boolean |
isBlocked() |
boolean |
isBlockedCandidate() |
boolean |
isConnected() |
boolean |
isFaultTolerantConnection() |
boolean |
isManageable() |
boolean |
isMarkedBlockedCandidate() |
boolean |
isMarkedCandidate() |
boolean |
isNetworkConnection()
return true if a network connection
|
boolean |
isPendingStop() |
boolean |
isSlow() |
boolean |
isStarting() |
boolean |
isStopping() |
boolean |
iterate() |
protected List<TransportConnectionState> |
listConnectionStates() |
TransportConnectionState |
lookupConnectionState(org.apache.activemq.command.ConnectionId connectionId) |
protected TransportConnectionState |
lookupConnectionState(org.apache.activemq.command.ConsumerId id) |
protected TransportConnectionState |
lookupConnectionState(org.apache.activemq.command.ProducerId id) |
protected TransportConnectionState |
lookupConnectionState(org.apache.activemq.command.SessionId id) |
protected TransportConnectionState |
lookupConnectionState(String connectionId) |
org.apache.activemq.command.Response |
processAddConnection(org.apache.activemq.command.ConnectionInfo info) |
org.apache.activemq.command.Response |
processAddConsumer(org.apache.activemq.command.ConsumerInfo info) |
org.apache.activemq.command.Response |
processAddDestination(org.apache.activemq.command.DestinationInfo info) |
org.apache.activemq.command.Response |
processAddProducer(org.apache.activemq.command.ProducerInfo info) |
org.apache.activemq.command.Response |
processAddSession(org.apache.activemq.command.SessionInfo info) |
org.apache.activemq.command.Response |
processBeginTransaction(org.apache.activemq.command.TransactionInfo info) |
org.apache.activemq.command.Response |
processBrokerInfo(org.apache.activemq.command.BrokerInfo info) |
org.apache.activemq.command.Response |
processBrokerSubscriptionInfo(org.apache.activemq.command.BrokerSubscriptionInfo info) |
org.apache.activemq.command.Response |
processCommitTransactionOnePhase(org.apache.activemq.command.TransactionInfo info) |
org.apache.activemq.command.Response |
processCommitTransactionTwoPhase(org.apache.activemq.command.TransactionInfo info) |
org.apache.activemq.command.Response |
processConnectionControl(org.apache.activemq.command.ConnectionControl control) |
org.apache.activemq.command.Response |
processConnectionError(org.apache.activemq.command.ConnectionError error) |
org.apache.activemq.command.Response |
processConsumerControl(org.apache.activemq.command.ConsumerControl control) |
org.apache.activemq.command.Response |
processControlCommand(org.apache.activemq.command.ControlCommand command) |
protected void |
processDispatch(org.apache.activemq.command.Command command) |
org.apache.activemq.command.Response |
processEndTransaction(org.apache.activemq.command.TransactionInfo info) |
org.apache.activemq.command.Response |
processFlush(org.apache.activemq.command.FlushCommand command) |
org.apache.activemq.command.Response |
processForgetTransaction(org.apache.activemq.command.TransactionInfo info) |
org.apache.activemq.command.Response |
processKeepAlive(org.apache.activemq.command.KeepAliveInfo info) |
org.apache.activemq.command.Response |
processMessage(org.apache.activemq.command.Message messageSend) |
org.apache.activemq.command.Response |
processMessageAck(org.apache.activemq.command.MessageAck ack) |
org.apache.activemq.command.Response |
processMessageDispatch(org.apache.activemq.command.MessageDispatch dispatch) |
org.apache.activemq.command.Response |
processMessageDispatchNotification(org.apache.activemq.command.MessageDispatchNotification notification) |
org.apache.activemq.command.Response |
processMessagePull(org.apache.activemq.command.MessagePull pull) |
org.apache.activemq.command.Response |
processPrepareTransaction(org.apache.activemq.command.TransactionInfo info) |
org.apache.activemq.command.Response |
processProducerAck(org.apache.activemq.command.ProducerAck ack) |
org.apache.activemq.command.Response |
processRecoverTransactions(org.apache.activemq.command.TransactionInfo info) |
org.apache.activemq.command.Response |
processRemoveConnection(org.apache.activemq.command.ConnectionId id,
long lastDeliveredSequenceId) |
org.apache.activemq.command.Response |
processRemoveConsumer(org.apache.activemq.command.ConsumerId id,
long lastDeliveredSequenceId) |
org.apache.activemq.command.Response |
processRemoveDestination(org.apache.activemq.command.DestinationInfo info) |
org.apache.activemq.command.Response |
processRemoveProducer(org.apache.activemq.command.ProducerId id) |
org.apache.activemq.command.Response |
processRemoveSession(org.apache.activemq.command.SessionId id,
long lastDeliveredSequenceId) |
org.apache.activemq.command.Response |
processRemoveSubscription(org.apache.activemq.command.RemoveSubscriptionInfo info) |
org.apache.activemq.command.Response |
processRollbackTransaction(org.apache.activemq.command.TransactionInfo info) |
org.apache.activemq.command.Response |
processShutdown(org.apache.activemq.command.ShutdownInfo info) |
org.apache.activemq.command.Response |
processWireFormat(org.apache.activemq.command.WireFormatInfo info) |
protected TransportConnectionState |
registerConnectionState(org.apache.activemq.command.ConnectionId connectionId,
TransportConnectionState state) |
org.apache.activemq.command.Response |
service(org.apache.activemq.command.Command command)
Services a client command and submits it to the broker.
|
void |
serviceException(Throwable e)
Closes a clients connection due to a detected error.
|
void |
serviceExceptionAsync(IOException e)
Calls the serviceException method in an async thread.
|
void |
serviceTransportException(IOException e) |
void |
setActive(boolean active) |
void |
setBlocked(boolean blocked) |
void |
setBlockedCandidate(boolean blockedCandidate) |
void |
setConnected(boolean connected) |
protected void |
setDuplexNetworkConnectorId(String duplexNetworkConnectorId) |
void |
setMarkedCandidate(boolean markedCandidate) |
void |
setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy) |
void |
setSlow(boolean slow) |
void |
start() |
void |
stop() |
void |
stopAsync() |
void |
stopAsync(Throwable cause) |
String |
toString() |
protected TransportConnectionState |
unregisterConnectionState(org.apache.activemq.command.ConnectionId connectionId) |
void |
updateClient(org.apache.activemq.command.ConnectionControl control) |
protected final BrokerService brokerService
protected final TransportConnector connector
protected final Map<org.apache.activemq.command.ConnectionId,org.apache.activemq.state.ConnectionState> brokerConnectionStates
protected org.apache.activemq.command.BrokerInfo brokerInfo
protected final List<org.apache.activemq.command.Command> dispatchQueue
protected org.apache.activemq.thread.TaskRunner taskRunner
protected final AtomicReference<Throwable> transportException
protected AtomicBoolean dispatchStopped
public TransportConnection(TransportConnector connector, org.apache.activemq.transport.Transport transport, Broker broker, org.apache.activemq.thread.TaskRunnerFactory taskRunnerFactory, org.apache.activemq.thread.TaskRunnerFactory stopTaskRunnerFactory)
taskRunnerFactory - - can be null if you want direct dispatch to the transport
else commands are sent async.stopTaskRunnerFactory - - can not be null, used for stopping this connection.public int getDispatchQueueSize()
getDispatchQueueSize in interface Connectionpublic void serviceTransportException(IOException e)
public void serviceExceptionAsync(IOException e)
serviceExceptionAsync in interface Connectionpublic void serviceException(Throwable e)
serviceException in interface Connectionpublic org.apache.activemq.command.Response service(org.apache.activemq.command.Command command)
Connectionservice in interface Connectionpublic org.apache.activemq.command.Response processKeepAlive(org.apache.activemq.command.KeepAliveInfo info) throws Exception
processKeepAlive in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processRemoveSubscription(org.apache.activemq.command.RemoveSubscriptionInfo info) throws Exception
processRemoveSubscription in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processWireFormat(org.apache.activemq.command.WireFormatInfo info) throws Exception
processWireFormat in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processShutdown(org.apache.activemq.command.ShutdownInfo info) throws Exception
processShutdown in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processFlush(org.apache.activemq.command.FlushCommand command) throws Exception
processFlush in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processBeginTransaction(org.apache.activemq.command.TransactionInfo info) throws Exception
processBeginTransaction in interface org.apache.activemq.state.CommandVisitorExceptionpublic int getActiveTransactionCount()
ConnectiongetActiveTransactionCount in interface Connectionpublic Long getOldestActiveTransactionDuration()
ConnectiongetOldestActiveTransactionDuration in interface Connectionpublic org.apache.activemq.command.Response processEndTransaction(org.apache.activemq.command.TransactionInfo info) throws Exception
processEndTransaction in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processPrepareTransaction(org.apache.activemq.command.TransactionInfo info) throws Exception
processPrepareTransaction in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processCommitTransactionOnePhase(org.apache.activemq.command.TransactionInfo info) throws Exception
processCommitTransactionOnePhase in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processCommitTransactionTwoPhase(org.apache.activemq.command.TransactionInfo info) throws Exception
processCommitTransactionTwoPhase in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processRollbackTransaction(org.apache.activemq.command.TransactionInfo info) throws Exception
processRollbackTransaction in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processForgetTransaction(org.apache.activemq.command.TransactionInfo info) throws Exception
processForgetTransaction in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processRecoverTransactions(org.apache.activemq.command.TransactionInfo info) throws Exception
processRecoverTransactions in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processMessage(org.apache.activemq.command.Message messageSend) throws Exception
processMessage in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processMessageAck(org.apache.activemq.command.MessageAck ack) throws Exception
processMessageAck in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processMessagePull(org.apache.activemq.command.MessagePull pull) throws Exception
processMessagePull in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processMessageDispatchNotification(org.apache.activemq.command.MessageDispatchNotification notification) throws Exception
processMessageDispatchNotification in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processAddDestination(org.apache.activemq.command.DestinationInfo info) throws Exception
processAddDestination in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processRemoveDestination(org.apache.activemq.command.DestinationInfo info) throws Exception
processRemoveDestination in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processAddProducer(org.apache.activemq.command.ProducerInfo info) throws Exception
processAddProducer in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processRemoveProducer(org.apache.activemq.command.ProducerId id) throws Exception
processRemoveProducer in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processAddConsumer(org.apache.activemq.command.ConsumerInfo info) throws Exception
processAddConsumer in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processRemoveConsumer(org.apache.activemq.command.ConsumerId id, long lastDeliveredSequenceId) throws Exception
processRemoveConsumer in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processAddSession(org.apache.activemq.command.SessionInfo info) throws Exception
processAddSession in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processRemoveSession(org.apache.activemq.command.SessionId id, long lastDeliveredSequenceId) throws Exception
processRemoveSession in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processAddConnection(org.apache.activemq.command.ConnectionInfo info) throws Exception
processAddConnection in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processRemoveConnection(org.apache.activemq.command.ConnectionId id, long lastDeliveredSequenceId) throws InterruptedException
processRemoveConnection in interface org.apache.activemq.state.CommandVisitorInterruptedExceptionpublic org.apache.activemq.command.Response processProducerAck(org.apache.activemq.command.ProducerAck ack) throws Exception
processProducerAck in interface org.apache.activemq.state.CommandVisitorExceptionpublic Connector getConnector()
getConnector in interface Connectionpublic void dispatchSync(org.apache.activemq.command.Command message)
ConnectiondispatchSync in interface Connectionmessage - the message to send to the client.public void dispatchAsync(org.apache.activemq.command.Command message)
ConnectiondispatchAsync in interface Connectionprotected void processDispatch(org.apache.activemq.command.Command command) throws IOException
IOExceptionpublic boolean iterate()
iterate in interface org.apache.activemq.thread.Taskpublic ConnectionStatistics getStatistics()
getStatistics in interface Connectionpublic MessageAuthorizationPolicy getMessageAuthorizationPolicy()
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy)
public boolean isManageable()
isManageable in interface Connectionpublic void start() throws Exception
start in interface org.apache.activemq.ServiceExceptionpublic void stop() throws Exception
stop in interface org.apache.activemq.ServiceExceptionpublic void delayedStop(int waitTime, String reason, Throwable cause)
public void stopAsync()
public boolean isBlockedCandidate()
public void setBlockedCandidate(boolean blockedCandidate)
blockedCandidate - The blockedCandidate to set.public boolean isMarkedCandidate()
public void setMarkedCandidate(boolean markedCandidate)
markedCandidate - The markedCandidate to set.public void setSlow(boolean slow)
slow - The slow to set.public boolean isSlow()
isSlow in interface Connectionpublic boolean isMarkedBlockedCandidate()
public void doMark()
public boolean isBlocked()
isBlocked in interface Connectionpublic boolean isConnected()
isConnected in interface Connectionpublic void setBlocked(boolean blocked)
blocked - The blocked to set.public void setConnected(boolean connected)
connected - The connected to set.public boolean isActive()
isActive in interface Connectionpublic void setActive(boolean active)
active - The active to set.public boolean isStarting()
public boolean isNetworkConnection()
ConnectionisNetworkConnection in interface Connectionpublic boolean isFaultTolerantConnection()
isFaultTolerantConnection in interface Connectionpublic boolean isPendingStop()
public org.apache.activemq.command.Response processBrokerInfo(org.apache.activemq.command.BrokerInfo info)
processBrokerInfo in interface org.apache.activemq.state.CommandVisitorprotected void dispatch(org.apache.activemq.command.Command command) throws IOException
IOExceptionpublic String getRemoteAddress()
getRemoteAddress in interface Connectionpublic org.apache.activemq.transport.Transport getTransport()
public String getConnectionId()
getConnectionId in interface Connectionpublic void updateClient(org.apache.activemq.command.ConnectionControl control)
updateClient in interface Connectionpublic ProducerBrokerExchange getProducerBrokerExchangeIfExists(org.apache.activemq.command.ProducerInfo producerInfo)
public int getProtocolVersion()
public org.apache.activemq.command.Response processControlCommand(org.apache.activemq.command.ControlCommand command) throws Exception
processControlCommand in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processMessageDispatch(org.apache.activemq.command.MessageDispatch dispatch) throws Exception
processMessageDispatch in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processConnectionControl(org.apache.activemq.command.ConnectionControl control) throws Exception
processConnectionControl in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processConnectionError(org.apache.activemq.command.ConnectionError error) throws Exception
processConnectionError in interface org.apache.activemq.state.CommandVisitorExceptionpublic org.apache.activemq.command.Response processConsumerControl(org.apache.activemq.command.ConsumerControl control) throws Exception
processConsumerControl in interface org.apache.activemq.state.CommandVisitorExceptionprotected TransportConnectionState registerConnectionState(org.apache.activemq.command.ConnectionId connectionId, TransportConnectionState state)
protected TransportConnectionState unregisterConnectionState(org.apache.activemq.command.ConnectionId connectionId)
protected List<TransportConnectionState> listConnectionStates()
protected TransportConnectionState lookupConnectionState(String connectionId)
protected TransportConnectionState lookupConnectionState(org.apache.activemq.command.ConsumerId id)
protected TransportConnectionState lookupConnectionState(org.apache.activemq.command.ProducerId id)
protected TransportConnectionState lookupConnectionState(org.apache.activemq.command.SessionId id)
public TransportConnectionState lookupConnectionState(org.apache.activemq.command.ConnectionId connectionId)
protected void setDuplexNetworkConnectorId(String duplexNetworkConnectorId)
protected String getDuplexNetworkConnectorId()
public boolean isStopping()
protected CountDownLatch getStopped()
public org.apache.activemq.command.WireFormatInfo getRemoteWireFormatInfo()
public org.apache.activemq.command.Response processBrokerSubscriptionInfo(org.apache.activemq.command.BrokerSubscriptionInfo info) throws Exception
processBrokerSubscriptionInfo in interface org.apache.activemq.state.CommandVisitorExceptionCopyright © 2005–2020 The Apache Software Foundation. All rights reserved.