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 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 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 Connectionpublic void serviceTransportException(IOException e)
public void serviceExceptionAsync(IOException e)
serviceExceptionAsync in interface Connectionpublic void serviceException(Throwable e)
serviceException in interface Connectionpublic Response service(Command command)
Connectionservice in interface Connectionpublic Response processKeepAlive(KeepAliveInfo info) throws Exception
processKeepAlive in interface CommandVisitorExceptionpublic Response processRemoveSubscription(RemoveSubscriptionInfo info) throws Exception
processRemoveSubscription in interface CommandVisitorExceptionpublic Response processWireFormat(WireFormatInfo info) throws Exception
processWireFormat in interface CommandVisitorExceptionpublic Response processShutdown(ShutdownInfo info) throws Exception
processShutdown in interface CommandVisitorExceptionpublic Response processFlush(FlushCommand command) throws Exception
processFlush in interface CommandVisitorExceptionpublic Response processBeginTransaction(TransactionInfo info) throws Exception
processBeginTransaction in interface CommandVisitorExceptionpublic int getActiveTransactionCount()
ConnectiongetActiveTransactionCount in interface Connectionpublic Long getOldestActiveTransactionDuration()
ConnectiongetOldestActiveTransactionDuration in interface Connectionpublic Response processEndTransaction(TransactionInfo info) throws Exception
processEndTransaction in interface CommandVisitorExceptionpublic Response processPrepareTransaction(TransactionInfo info) throws Exception
processPrepareTransaction in interface CommandVisitorExceptionpublic Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception
processCommitTransactionOnePhase in interface CommandVisitorExceptionpublic Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception
processCommitTransactionTwoPhase in interface CommandVisitorExceptionpublic Response processRollbackTransaction(TransactionInfo info) throws Exception
processRollbackTransaction in interface CommandVisitorExceptionpublic Response processForgetTransaction(TransactionInfo info) throws Exception
processForgetTransaction in interface CommandVisitorExceptionpublic Response processRecoverTransactions(TransactionInfo info) throws Exception
processRecoverTransactions in interface CommandVisitorExceptionpublic Response processMessage(Message messageSend) throws Exception
processMessage in interface CommandVisitorExceptionpublic Response processMessageAck(MessageAck ack) throws Exception
processMessageAck in interface CommandVisitorExceptionpublic Response processMessagePull(MessagePull pull) throws Exception
processMessagePull in interface CommandVisitorExceptionpublic Response processMessageDispatchNotification(MessageDispatchNotification notification) throws Exception
processMessageDispatchNotification in interface CommandVisitorExceptionpublic Response processAddDestination(DestinationInfo info) throws Exception
processAddDestination in interface CommandVisitorExceptionpublic Response processRemoveDestination(DestinationInfo info) throws Exception
processRemoveDestination in interface CommandVisitorExceptionpublic Response processAddProducer(ProducerInfo info) throws Exception
processAddProducer in interface CommandVisitorExceptionpublic Response processRemoveProducer(ProducerId id) throws Exception
processRemoveProducer in interface CommandVisitorExceptionpublic Response processAddConsumer(ConsumerInfo info) throws Exception
processAddConsumer in interface CommandVisitorExceptionpublic Response processRemoveConsumer(ConsumerId id, long lastDeliveredSequenceId) throws Exception
processRemoveConsumer in interface CommandVisitorExceptionpublic Response processAddSession(SessionInfo info) throws Exception
processAddSession in interface CommandVisitorExceptionpublic Response processRemoveSession(SessionId id, long lastDeliveredSequenceId) throws Exception
processRemoveSession in interface CommandVisitorExceptionpublic Response processAddConnection(ConnectionInfo info) throws Exception
processAddConnection in interface CommandVisitorExceptionpublic Response processRemoveConnection(ConnectionId id, long lastDeliveredSequenceId) throws InterruptedException
processRemoveConnection in interface CommandVisitorInterruptedExceptionpublic Response processProducerAck(ProducerAck ack) throws Exception
processProducerAck in interface CommandVisitorExceptionpublic Connector getConnector()
getConnector in interface Connectionpublic void dispatchSync(Command message)
ConnectiondispatchSync in interface Connectionmessage - the message to send to the client.public void dispatchAsync(Command message)
ConnectiondispatchAsync in interface Connectionprotected void processDispatch(Command command) throws IOException
IOExceptionpublic ConnectionStatistics getStatistics()
getStatistics in interface Connectionpublic MessageAuthorizationPolicy getMessageAuthorizationPolicy()
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy)
public boolean isManageable()
isManageable in interface Connectionpublic 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 Connectionprotected void setStarting(boolean starting)
public boolean isPendingStop()
protected void setPendingStop(boolean pendingStop)
public Response processBrokerInfo(BrokerInfo info)
processBrokerInfo in interface CommandVisitorprotected void dispatch(Command command) throws IOException
IOExceptionpublic String getRemoteAddress()
getRemoteAddress in interface Connectionpublic Transport getTransport()
public String getConnectionId()
getConnectionId in interface Connectionpublic void updateClient(ConnectionControl control)
updateClient in interface Connectionpublic ProducerBrokerExchange getProducerBrokerExchangeIfExists(ProducerInfo producerInfo)
public int getProtocolVersion()
public Response processControlCommand(ControlCommand command) throws Exception
processControlCommand in interface CommandVisitorExceptionpublic Response processMessageDispatch(MessageDispatch dispatch) throws Exception
processMessageDispatch in interface CommandVisitorExceptionpublic Response processConnectionControl(ConnectionControl control) throws Exception
processConnectionControl in interface CommandVisitorExceptionpublic Response processConnectionError(ConnectionError error) throws Exception
processConnectionError in interface CommandVisitorExceptionpublic Response processConsumerControl(ConsumerControl control) throws Exception
processConsumerControl in interface CommandVisitorExceptionprotected 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()
Copyright © 2005–2015 FuseSource, Corp.. All rights reserved.