Package org.apache.activemq.state
Class ConnectionStateTracker
java.lang.Object
org.apache.activemq.state.CommandVisitorAdapter
org.apache.activemq.state.ConnectionStateTracker
- All Implemented Interfaces:
CommandVisitor
Tracks the state of a connection so a newly established transport can be
re-initialized to the state that was tracked.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
connectionInterruptProcessingComplete
(Transport transport, ConnectionId connectionId) long
int
boolean
boolean
boolean
boolean
boolean
boolean
boolean
processAddSession
(SessionInfo info) processMessage
(Message send) processRemoveConnection
(ConnectionId id, long lastDeliveredSequenceId) processRemoveConsumer
(ConsumerId id, long lastDeliveredSequenceId) processRemoveSession
(SessionId id, long lastDeliveredSequenceId) void
protected void
restoreConsumers
(Transport transport, SessionState sessionState) protected void
restoreProducers
(Transport transport, SessionState sessionState) protected void
restoreSessions
(Transport transport, ConnectionState connectionState) protected void
restoreTempDestinations
(Transport transport, ConnectionState connectionState) void
setMaxCacheSize
(int maxCacheSize) void
setRestoreConsumers
(boolean restoreConsumers) void
setRestoreProducers
(boolean restoreProducers) void
setRestoreSessions
(boolean restoreSessions) void
setRestoreTransaction
(boolean restoreTransaction) void
setTrackMessages
(boolean trackMessages) void
setTrackTransactionProducers
(boolean trackTransactionProducers) void
setTrackTransactions
(boolean trackTransactions) Entry point for all tracked commands in the tracker.void
Completes the two phase tracking operation for a command that is sent on the wire.void
transportInterrupted
(ConnectionId connectionId) Methods inherited from class org.apache.activemq.state.CommandVisitorAdapter
processBrokerInfo, processBrokerSubscriptionInfo, processConnectionControl, processConnectionError, processConsumerControl, processControlCommand, processFlush, processForgetTransaction, processKeepAlive, processMessageAck, processMessageDispatch, processMessageDispatchNotification, processProducerAck, processRecoverTransactions, processRemoveSubscription, processShutdown, processWireFormat
-
Field Details
-
connectionStates
-
-
Constructor Details
-
ConnectionStateTracker
public ConnectionStateTracker()
-
-
Method Details
-
track
Entry point for all tracked commands in the tracker. Commands should be tracked before there is an attempt to send them on the wire. Upon a successful send of a command it is necessary to call the trackBack method to complete the tracking of the given command.- Parameters:
command
- The command that is to be tracked by this tracker.- Returns:
- null if the command is not state tracked.
- Throws:
IOException
- if an error occurs during setup of the tracking operation.
-
trackBack
Completes the two phase tracking operation for a command that is sent on the wire. Once the command is sent successfully to complete the tracking operation or otherwise update the state of the tracker.- Parameters:
command
- The command that was previously provided to the track method.
-
restore
- Throws:
IOException
-
restoreSessions
protected void restoreSessions(Transport transport, ConnectionState connectionState) throws IOException - Parameters:
transport
-connectionState
-- Throws:
IOException
-
restoreConsumers
- Parameters:
transport
-sessionState
-- Throws:
IOException
-
restoreProducers
- Parameters:
transport
-sessionState
-- Throws:
IOException
-
restoreTempDestinations
protected void restoreTempDestinations(Transport transport, ConnectionState connectionState) throws IOException - Parameters:
transport
-connectionState
-- Throws:
IOException
-
processAddDestination
- Specified by:
processAddDestination
in interfaceCommandVisitor
- Overrides:
processAddDestination
in classCommandVisitorAdapter
-
processRemoveDestination
- Specified by:
processRemoveDestination
in interfaceCommandVisitor
- Overrides:
processRemoveDestination
in classCommandVisitorAdapter
-
processAddProducer
- Specified by:
processAddProducer
in interfaceCommandVisitor
- Overrides:
processAddProducer
in classCommandVisitorAdapter
-
processRemoveProducer
- Specified by:
processRemoveProducer
in interfaceCommandVisitor
- Overrides:
processRemoveProducer
in classCommandVisitorAdapter
-
processAddConsumer
- Specified by:
processAddConsumer
in interfaceCommandVisitor
- Overrides:
processAddConsumer
in classCommandVisitorAdapter
-
processRemoveConsumer
- Specified by:
processRemoveConsumer
in interfaceCommandVisitor
- Overrides:
processRemoveConsumer
in classCommandVisitorAdapter
-
processAddSession
- Specified by:
processAddSession
in interfaceCommandVisitor
- Overrides:
processAddSession
in classCommandVisitorAdapter
-
processRemoveSession
- Specified by:
processRemoveSession
in interfaceCommandVisitor
- Overrides:
processRemoveSession
in classCommandVisitorAdapter
-
processAddConnection
- Specified by:
processAddConnection
in interfaceCommandVisitor
- Overrides:
processAddConnection
in classCommandVisitorAdapter
-
processRemoveConnection
public Response processRemoveConnection(ConnectionId id, long lastDeliveredSequenceId) throws Exception - Specified by:
processRemoveConnection
in interfaceCommandVisitor
- Overrides:
processRemoveConnection
in classCommandVisitorAdapter
- Throws:
Exception
-
processMessage
- Specified by:
processMessage
in interfaceCommandVisitor
- Overrides:
processMessage
in classCommandVisitorAdapter
- Throws:
Exception
-
processBeginTransaction
- Specified by:
processBeginTransaction
in interfaceCommandVisitor
- Overrides:
processBeginTransaction
in classCommandVisitorAdapter
-
processPrepareTransaction
- Specified by:
processPrepareTransaction
in interfaceCommandVisitor
- Overrides:
processPrepareTransaction
in classCommandVisitorAdapter
- Throws:
Exception
-
processCommitTransactionOnePhase
- Specified by:
processCommitTransactionOnePhase
in interfaceCommandVisitor
- Overrides:
processCommitTransactionOnePhase
in classCommandVisitorAdapter
- Throws:
Exception
-
processCommitTransactionTwoPhase
- Specified by:
processCommitTransactionTwoPhase
in interfaceCommandVisitor
- Overrides:
processCommitTransactionTwoPhase
in classCommandVisitorAdapter
- Throws:
Exception
-
processRollbackTransaction
- Specified by:
processRollbackTransaction
in interfaceCommandVisitor
- Overrides:
processRollbackTransaction
in classCommandVisitorAdapter
- Throws:
Exception
-
processEndTransaction
- Specified by:
processEndTransaction
in interfaceCommandVisitor
- Overrides:
processEndTransaction
in classCommandVisitorAdapter
- Throws:
Exception
-
processMessagePull
- Specified by:
processMessagePull
in interfaceCommandVisitor
- Overrides:
processMessagePull
in classCommandVisitorAdapter
- Throws:
Exception
-
isRestoreConsumers
public boolean isRestoreConsumers() -
setRestoreConsumers
public void setRestoreConsumers(boolean restoreConsumers) -
isRestoreProducers
public boolean isRestoreProducers() -
setRestoreProducers
public void setRestoreProducers(boolean restoreProducers) -
isRestoreSessions
public boolean isRestoreSessions() -
setRestoreSessions
public void setRestoreSessions(boolean restoreSessions) -
isTrackTransactions
public boolean isTrackTransactions() -
setTrackTransactions
public void setTrackTransactions(boolean trackTransactions) -
isTrackTransactionProducers
public boolean isTrackTransactionProducers() -
setTrackTransactionProducers
public void setTrackTransactionProducers(boolean trackTransactionProducers) -
isRestoreTransaction
public boolean isRestoreTransaction() -
setRestoreTransaction
public void setRestoreTransaction(boolean restoreTransaction) -
isTrackMessages
public boolean isTrackMessages() -
setTrackMessages
public void setTrackMessages(boolean trackMessages) -
getMaxCacheSize
public int getMaxCacheSize() -
setMaxCacheSize
public void setMaxCacheSize(int maxCacheSize) -
getCurrentCacheSize
public long getCurrentCacheSize()- Returns:
- the current cache size for the Message and MessagePull Command cache.
-
connectionInterruptProcessingComplete
-
transportInterrupted
-