public class TransportConnection extends Object implements Connection, Task, CommandVisitor
Modifier and Type | Field and Description |
---|---|
protected Broker |
broker |
protected Map<ConnectionId,ConnectionState> |
brokerConnectionStates |
protected BrokerInfo |
brokerInfo |
protected BrokerService |
brokerService |
protected TransportConnector |
connector |
protected List<Command> |
dispatchQueue |
protected AtomicBoolean |
dispatchStopped |
protected TaskRunner |
taskRunner |
protected AtomicReference<Throwable> |
transportException |
Constructor and Description |
---|
TransportConnection(TransportConnector connector,
Transport transport,
Broker broker,
TaskRunnerFactory taskRunnerFactory,
TaskRunnerFactory stopTaskRunnerFactory) |
protected final BrokerService brokerService
protected final TransportConnector connector
protected final Map<ConnectionId,ConnectionState> brokerConnectionStates
protected BrokerInfo brokerInfo
protected final List<Command> dispatchQueue
protected TaskRunner taskRunner
protected final AtomicReference<Throwable> transportException
protected AtomicBoolean dispatchStopped
public TransportConnection(TransportConnector connector, Transport transport, Broker broker, TaskRunnerFactory taskRunnerFactory, 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 Connection
public void serviceTransportException(IOException e)
public void serviceExceptionAsync(IOException e)
serviceExceptionAsync
in interface Connection
public void serviceException(Throwable e)
serviceException
in interface Connection
public Response service(Command command)
Connection
service
in interface Connection
public Response processKeepAlive(KeepAliveInfo info) throws Exception
processKeepAlive
in interface CommandVisitor
Exception
public Response processRemoveSubscription(RemoveSubscriptionInfo info) throws Exception
processRemoveSubscription
in interface CommandVisitor
Exception
public Response processWireFormat(WireFormatInfo info) throws Exception
processWireFormat
in interface CommandVisitor
Exception
public Response processShutdown(ShutdownInfo info) throws Exception
processShutdown
in interface CommandVisitor
Exception
public Response processFlush(FlushCommand command) throws Exception
processFlush
in interface CommandVisitor
Exception
public Response processBeginTransaction(TransactionInfo info) throws Exception
processBeginTransaction
in interface CommandVisitor
Exception
public int getActiveTransactionCount()
Connection
getActiveTransactionCount
in interface Connection
public Long getOldestActiveTransactionDuration()
Connection
getOldestActiveTransactionDuration
in interface Connection
public Response processEndTransaction(TransactionInfo info) throws Exception
processEndTransaction
in interface CommandVisitor
Exception
public Response processPrepareTransaction(TransactionInfo info) throws Exception
processPrepareTransaction
in interface CommandVisitor
Exception
public Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception
processCommitTransactionOnePhase
in interface CommandVisitor
Exception
public Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception
processCommitTransactionTwoPhase
in interface CommandVisitor
Exception
public Response processRollbackTransaction(TransactionInfo info) throws Exception
processRollbackTransaction
in interface CommandVisitor
Exception
public Response processForgetTransaction(TransactionInfo info) throws Exception
processForgetTransaction
in interface CommandVisitor
Exception
public Response processRecoverTransactions(TransactionInfo info) throws Exception
processRecoverTransactions
in interface CommandVisitor
Exception
public Response processMessage(Message messageSend) throws Exception
processMessage
in interface CommandVisitor
Exception
public Response processMessageAck(MessageAck ack) throws Exception
processMessageAck
in interface CommandVisitor
Exception
public Response processMessagePull(MessagePull pull) throws Exception
processMessagePull
in interface CommandVisitor
Exception
public Response processMessageDispatchNotification(MessageDispatchNotification notification) throws Exception
processMessageDispatchNotification
in interface CommandVisitor
Exception
public Response processAddDestination(DestinationInfo info) throws Exception
processAddDestination
in interface CommandVisitor
Exception
public Response processRemoveDestination(DestinationInfo info) throws Exception
processRemoveDestination
in interface CommandVisitor
Exception
public Response processAddProducer(ProducerInfo info) throws Exception
processAddProducer
in interface CommandVisitor
Exception
public Response processRemoveProducer(ProducerId id) throws Exception
processRemoveProducer
in interface CommandVisitor
Exception
public Response processAddConsumer(ConsumerInfo info) throws Exception
processAddConsumer
in interface CommandVisitor
Exception
public Response processRemoveConsumer(ConsumerId id, long lastDeliveredSequenceId) throws Exception
processRemoveConsumer
in interface CommandVisitor
Exception
public Response processAddSession(SessionInfo info) throws Exception
processAddSession
in interface CommandVisitor
Exception
public Response processRemoveSession(SessionId id, long lastDeliveredSequenceId) throws Exception
processRemoveSession
in interface CommandVisitor
Exception
public Response processAddConnection(ConnectionInfo info) throws Exception
processAddConnection
in interface CommandVisitor
Exception
public Response processRemoveConnection(ConnectionId id, long lastDeliveredSequenceId) throws InterruptedException
processRemoveConnection
in interface CommandVisitor
InterruptedException
public Response processProducerAck(ProducerAck ack) throws Exception
processProducerAck
in interface CommandVisitor
Exception
public Connector getConnector()
getConnector
in interface Connection
public void dispatchSync(Command message)
Connection
dispatchSync
in interface Connection
message
- the message to send to the client.public void dispatchAsync(Command message)
Connection
dispatchAsync
in interface Connection
protected void processDispatch(Command command) throws IOException
IOException
public ConnectionStatistics getStatistics()
getStatistics
in interface Connection
public MessageAuthorizationPolicy getMessageAuthorizationPolicy()
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy)
public boolean isManageable()
isManageable
in interface Connection
public 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 Connection
public boolean isMarkedBlockedCandidate()
public void doMark()
public boolean isBlocked()
isBlocked
in interface Connection
public boolean isConnected()
isConnected
in interface Connection
public 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 Connection
public void setActive(boolean active)
active
- The active to set.public boolean isStarting()
public boolean isNetworkConnection()
Connection
isNetworkConnection
in interface Connection
public boolean isFaultTolerantConnection()
isFaultTolerantConnection
in interface Connection
protected void setStarting(boolean starting)
public boolean isPendingStop()
protected void setPendingStop(boolean pendingStop)
public Response processBrokerInfo(BrokerInfo info)
processBrokerInfo
in interface CommandVisitor
protected void dispatch(Command command) throws IOException
IOException
public String getRemoteAddress()
getRemoteAddress
in interface Connection
public Transport getTransport()
public String getConnectionId()
getConnectionId
in interface Connection
public void updateClient(ConnectionControl control)
updateClient
in interface Connection
public ProducerBrokerExchange getProducerBrokerExchangeIfExists(ProducerInfo producerInfo)
public int getProtocolVersion()
public Response processControlCommand(ControlCommand command) throws Exception
processControlCommand
in interface CommandVisitor
Exception
public Response processMessageDispatch(MessageDispatch dispatch) throws Exception
processMessageDispatch
in interface CommandVisitor
Exception
public Response processConnectionControl(ConnectionControl control) throws Exception
processConnectionControl
in interface CommandVisitor
Exception
public Response processConnectionError(ConnectionError error) throws Exception
processConnectionError
in interface CommandVisitor
Exception
public Response processConsumerControl(ConsumerControl control) throws Exception
processConsumerControl
in interface CommandVisitor
Exception
protected TransportConnectionState registerConnectionState(ConnectionId connectionId, TransportConnectionState state)
protected TransportConnectionState unregisterConnectionState(ConnectionId connectionId)
protected List<TransportConnectionState> listConnectionStates()
protected TransportConnectionState lookupConnectionState(String connectionId)
protected TransportConnectionState lookupConnectionState(ConsumerId id)
protected TransportConnectionState lookupConnectionState(ProducerId id)
protected TransportConnectionState lookupConnectionState(SessionId id)
public TransportConnectionState lookupConnectionState(ConnectionId connectionId)
protected void setDuplexNetworkConnectorId(String duplexNetworkConnectorId)
protected String getDuplexNetworkConnectorId()
public boolean isStopping()
protected CountDownLatch getStopped()
public WireFormatInfo getRemoteWireFormatInfo()
public Response processBrokerSubscriptionInfo(BrokerSubscriptionInfo info) throws Exception
processBrokerSubscriptionInfo
in interface CommandVisitor
Exception
Copyright © 2005–2024 The Apache Software Foundation. All rights reserved.