public class TransportConnection extends java.lang.Object implements Connection, Task, CommandVisitor
| Modifier and Type | Field and Description |
|---|---|
protected Broker |
broker |
protected java.util.Map<ConnectionId,ConnectionState> |
brokerConnectionStates |
protected BrokerInfo |
brokerInfo |
protected TransportConnector |
connector |
protected java.util.List<Command> |
dispatchQueue |
protected java.util.concurrent.atomic.AtomicBoolean |
dispatchStopped |
protected TaskRunner |
taskRunner |
protected java.util.concurrent.atomic.AtomicReference<java.io.IOException> |
transportException |
| Constructor and Description |
|---|
TransportConnection(TransportConnector connector,
Transport transport,
Broker broker,
TaskRunnerFactory taskRunnerFactory,
TaskRunnerFactory stopTaskRunnerFactory) |
protected final Broker broker
protected final TransportConnector connector
protected final java.util.Map<ConnectionId,ConnectionState> brokerConnectionStates
protected BrokerInfo brokerInfo
protected final java.util.List<Command> dispatchQueue
protected TaskRunner taskRunner
protected final java.util.concurrent.atomic.AtomicReference<java.io.IOException> transportException
protected java.util.concurrent.atomic.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(java.io.IOException e)
public void serviceExceptionAsync(java.io.IOException e)
serviceExceptionAsync in interface Connectionpublic void serviceException(java.lang.Throwable e)
serviceException in interface Connectionpublic Response service(Command command)
Connectionservice in interface Connectionpublic Response processKeepAlive(KeepAliveInfo info) throws java.lang.Exception
processKeepAlive in interface CommandVisitorjava.lang.Exceptionpublic Response processRemoveSubscription(RemoveSubscriptionInfo info) throws java.lang.Exception
processRemoveSubscription in interface CommandVisitorjava.lang.Exceptionpublic Response processWireFormat(WireFormatInfo info) throws java.lang.Exception
processWireFormat in interface CommandVisitorjava.lang.Exceptionpublic Response processShutdown(ShutdownInfo info) throws java.lang.Exception
processShutdown in interface CommandVisitorjava.lang.Exceptionpublic Response processFlush(FlushCommand command) throws java.lang.Exception
processFlush in interface CommandVisitorjava.lang.Exceptionpublic Response processBeginTransaction(TransactionInfo info) throws java.lang.Exception
processBeginTransaction in interface CommandVisitorjava.lang.Exceptionpublic int getActiveTransactionCount()
ConnectiongetActiveTransactionCount in interface Connectionpublic java.lang.Long getOldestActiveTransactionDuration()
ConnectiongetOldestActiveTransactionDuration in interface Connectionpublic Response processEndTransaction(TransactionInfo info) throws java.lang.Exception
processEndTransaction in interface CommandVisitorjava.lang.Exceptionpublic Response processPrepareTransaction(TransactionInfo info) throws java.lang.Exception
processPrepareTransaction in interface CommandVisitorjava.lang.Exceptionpublic Response processCommitTransactionOnePhase(TransactionInfo info) throws java.lang.Exception
processCommitTransactionOnePhase in interface CommandVisitorjava.lang.Exceptionpublic Response processCommitTransactionTwoPhase(TransactionInfo info) throws java.lang.Exception
processCommitTransactionTwoPhase in interface CommandVisitorjava.lang.Exceptionpublic Response processRollbackTransaction(TransactionInfo info) throws java.lang.Exception
processRollbackTransaction in interface CommandVisitorjava.lang.Exceptionpublic Response processForgetTransaction(TransactionInfo info) throws java.lang.Exception
processForgetTransaction in interface CommandVisitorjava.lang.Exceptionpublic Response processRecoverTransactions(TransactionInfo info) throws java.lang.Exception
processRecoverTransactions in interface CommandVisitorjava.lang.Exceptionpublic Response processMessage(Message messageSend) throws java.lang.Exception
processMessage in interface CommandVisitorjava.lang.Exceptionpublic Response processMessageAck(MessageAck ack) throws java.lang.Exception
processMessageAck in interface CommandVisitorjava.lang.Exceptionpublic Response processMessagePull(MessagePull pull) throws java.lang.Exception
processMessagePull in interface CommandVisitorjava.lang.Exceptionpublic Response processMessageDispatchNotification(MessageDispatchNotification notification) throws java.lang.Exception
processMessageDispatchNotification in interface CommandVisitorjava.lang.Exceptionpublic Response processAddDestination(DestinationInfo info) throws java.lang.Exception
processAddDestination in interface CommandVisitorjava.lang.Exceptionpublic Response processRemoveDestination(DestinationInfo info) throws java.lang.Exception
processRemoveDestination in interface CommandVisitorjava.lang.Exceptionpublic Response processAddProducer(ProducerInfo info) throws java.lang.Exception
processAddProducer in interface CommandVisitorjava.lang.Exceptionpublic Response processRemoveProducer(ProducerId id) throws java.lang.Exception
processRemoveProducer in interface CommandVisitorjava.lang.Exceptionpublic Response processAddConsumer(ConsumerInfo info) throws java.lang.Exception
processAddConsumer in interface CommandVisitorjava.lang.Exceptionpublic Response processRemoveConsumer(ConsumerId id, long lastDeliveredSequenceId) throws java.lang.Exception
processRemoveConsumer in interface CommandVisitorjava.lang.Exceptionpublic Response processAddSession(SessionInfo info) throws java.lang.Exception
processAddSession in interface CommandVisitorjava.lang.Exceptionpublic Response processRemoveSession(SessionId id, long lastDeliveredSequenceId) throws java.lang.Exception
processRemoveSession in interface CommandVisitorjava.lang.Exceptionpublic Response processAddConnection(ConnectionInfo info) throws java.lang.Exception
processAddConnection in interface CommandVisitorjava.lang.Exceptionpublic Response processRemoveConnection(ConnectionId id, long lastDeliveredSequenceId) throws java.lang.InterruptedException
processRemoveConnection in interface CommandVisitorjava.lang.InterruptedExceptionpublic Response processProducerAck(ProducerAck ack) throws java.lang.Exception
processProducerAck in interface CommandVisitorjava.lang.Exceptionpublic 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 java.io.IOException
java.io.IOExceptionpublic ConnectionStatistics getStatistics()
getStatistics in interface Connectionpublic MessageAuthorizationPolicy getMessageAuthorizationPolicy()
public void setMessageAuthorizationPolicy(MessageAuthorizationPolicy messageAuthorizationPolicy)
public boolean isManageable()
isManageable in interface Connectionpublic void start()
throws java.lang.Exception
public void stop()
throws java.lang.Exception
public void delayedStop(int waitTime,
java.lang.String reason,
java.lang.Throwable cause)
public void stopAsync()
public java.lang.String toString()
toString in class java.lang.Objectprotected void doStop()
throws java.lang.Exception
java.lang.Exceptionpublic 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 java.io.IOException
java.io.IOExceptionpublic java.lang.String getRemoteAddress()
getRemoteAddress in interface Connectionpublic Transport getTransport()
public java.lang.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 java.lang.Exception
processControlCommand in interface CommandVisitorjava.lang.Exceptionpublic Response processMessageDispatch(MessageDispatch dispatch) throws java.lang.Exception
processMessageDispatch in interface CommandVisitorjava.lang.Exceptionpublic Response processConnectionControl(ConnectionControl control) throws java.lang.Exception
processConnectionControl in interface CommandVisitorjava.lang.Exceptionpublic Response processConnectionError(ConnectionError error) throws java.lang.Exception
processConnectionError in interface CommandVisitorjava.lang.Exceptionpublic Response processConsumerControl(ConsumerControl control) throws java.lang.Exception
processConsumerControl in interface CommandVisitorjava.lang.Exceptionprotected TransportConnectionState registerConnectionState(ConnectionId connectionId, TransportConnectionState state)
protected TransportConnectionState unregisterConnectionState(ConnectionId connectionId)
protected java.util.List<TransportConnectionState> listConnectionStates()
protected TransportConnectionState lookupConnectionState(java.lang.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(java.lang.String duplexNetworkConnectorId)
protected java.lang.String getDuplexNetworkConnectorId()
public boolean isStopping()
protected java.util.concurrent.CountDownLatch getStopped()
public WireFormatInfo getRemoteWireFormatInfo()
Copyright © 2005-2014 Red Hat, Inc.. All Rights Reserved.