/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _ACTIVEMQ_STATE_CONNECTIONSTATETRACKER_H_ #define _ACTIVEMQ_STATE_CONNECTIONSTATETRACKER_H_ #include #include #include #include #include #include #include #include #include #include #include #include namespace activemq { namespace state { class RemoveTransactionAction; class StateTrackerImpl; class AMQCPP_API ConnectionStateTracker: public CommandVisitorAdapter { private: StateTrackerImpl* impl; bool trackTransactions; bool restoreSessions; bool restoreConsumers; bool restoreProducers; bool restoreTransaction; bool trackMessages; bool trackTransactionProducers; int maxMessageCacheSize; int maxMessagePullCacheSize; friend class RemoveTransactionAction; public: ConnectionStateTracker(); virtual ~ConnectionStateTracker(); Pointer track(Pointer command); void trackBack(decaf::lang::Pointer command); void restore(decaf::lang::Pointer transport); void connectionInterruptProcessingComplete( transport::Transport* transport, decaf::lang::Pointer connectionId); void transportInterrupted(); virtual decaf::lang::Pointer processDestinationInfo(DestinationInfo* info); virtual decaf::lang::Pointer processRemoveDestination(DestinationInfo* info); virtual decaf::lang::Pointer processProducerInfo(ProducerInfo* info); virtual decaf::lang::Pointer processRemoveProducer(ProducerId* id); virtual decaf::lang::Pointer processConsumerInfo(ConsumerInfo* info); virtual decaf::lang::Pointer processRemoveConsumer(ConsumerId* id); virtual decaf::lang::Pointer processSessionInfo(SessionInfo* info); virtual decaf::lang::Pointer processRemoveSession(SessionId* id); virtual decaf::lang::Pointer processConnectionInfo(ConnectionInfo* info); virtual decaf::lang::Pointer processRemoveConnection(ConnectionId* id); virtual decaf::lang::Pointer processMessage(Message* message); virtual decaf::lang::Pointer processBeginTransaction(TransactionInfo* info); virtual decaf::lang::Pointer processPrepareTransaction(TransactionInfo* info); virtual decaf::lang::Pointer processCommitTransactionOnePhase(TransactionInfo* info); virtual decaf::lang::Pointer processCommitTransactionTwoPhase(TransactionInfo* info); virtual decaf::lang::Pointer processRollbackTransaction(TransactionInfo* info); virtual decaf::lang::Pointer processEndTransaction(TransactionInfo* info); virtual decaf::lang::Pointer processMessagePull(MessagePull* pull); bool isRestoreConsumers() const { return this->restoreConsumers; } void setRestoreConsumers(bool restoreConsumers) { this->restoreConsumers = restoreConsumers; } bool isRestoreProducers() const { return this->restoreProducers; } void setRestoreProducers(bool restoreProducers) { this->restoreProducers = restoreProducers; } bool isRestoreSessions() const { return this->restoreSessions; } void setRestoreSessions(bool restoreSessions) { this->restoreSessions = restoreSessions; } bool isTrackTransactions() const { return this->trackTransactions; } void setTrackTransactions(bool trackTransactions) { this->trackTransactions = trackTransactions; } bool isRestoreTransaction() const { return this->restoreTransaction; } void setRestoreTransaction(bool restoreTransaction) { this->restoreTransaction = restoreTransaction; } bool isTrackMessages() const { return this->trackMessages; } void setTrackMessages(bool trackMessages) { this->trackMessages = trackMessages; } int getMaxMessageCacheSize() const { return this->maxMessageCacheSize; } void setMaxMessageCacheSize(int maxMessageCacheSize) { this->maxMessageCacheSize = maxMessageCacheSize; } int getMaxMessagePullCacheSize() const { return this->maxMessagePullCacheSize; } void setMaxMessagePullCacheSize(int maxMessagePullCacheSize) { this->maxMessagePullCacheSize = maxMessagePullCacheSize; } bool isTrackTransactionProducers() const { return this->trackTransactionProducers; } void setTrackTransactionProducers(bool trackTransactionProducers) { this->trackTransactionProducers = trackTransactionProducers; } private: void doRestoreTransactions(decaf::lang::Pointer transport, decaf::lang::Pointer connectionState); void doRestoreSessions(decaf::lang::Pointer transport, decaf::lang::Pointer connectionState); void doRestoreConsumers(decaf::lang::Pointer transport, decaf::lang::Pointer sessionState); void doRestoreProducers(decaf::lang::Pointer transport, decaf::lang::Pointer sessionState); void doRestoreTempDestinations(decaf::lang::Pointer transport, decaf::lang::Pointer connectionState); }; }} #endif /*_ACTIVEMQ_STATE_CONNECTIONSTATETRACKER_H_*/