activemq-cpp-3.8.2
ConnectionStateTracker.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _ACTIVEMQ_STATE_CONNECTIONSTATETRACKER_H_
19 #define _ACTIVEMQ_STATE_CONNECTIONSTATETRACKER_H_
20 
21 #include <activemq/util/Config.h>
30 #include <activemq/state/Tracked.h>
32 
33 #include <decaf/lang/Pointer.h>
34 
35 namespace activemq {
36 namespace state {
37 
38  class RemoveTransactionAction;
39  class StateTrackerImpl;
40 
42  private:
43 
44  StateTrackerImpl* impl;
45 
46  bool trackTransactions;
47  bool restoreSessions;
48  bool restoreConsumers;
49  bool restoreProducers;
50  bool restoreTransaction;
51  bool trackMessages;
52  bool trackTransactionProducers;
53  int maxMessageCacheSize;
54  int maxMessagePullCacheSize;
55 
56  friend class RemoveTransactionAction;
57 
58  public:
59 
61 
62  virtual ~ConnectionStateTracker();
63 
64  Pointer<Tracked> track(Pointer<Command> command);
65 
66  void trackBack(decaf::lang::Pointer<Command> command);
67 
68  void restore(decaf::lang::Pointer<transport::Transport> transport);
69 
70  void connectionInterruptProcessingComplete(
72 
73  void transportInterrupted();
74 
75  virtual decaf::lang::Pointer<Command> processDestinationInfo(DestinationInfo* info);
76 
77  virtual decaf::lang::Pointer<Command> processRemoveDestination(DestinationInfo* info);
78 
79  virtual decaf::lang::Pointer<Command> processProducerInfo(ProducerInfo* info);
80 
81  virtual decaf::lang::Pointer<Command> processRemoveProducer(ProducerId* id);
82 
83  virtual decaf::lang::Pointer<Command> processConsumerInfo(ConsumerInfo* info);
84 
85  virtual decaf::lang::Pointer<Command> processRemoveConsumer(ConsumerId* id);
86 
87  virtual decaf::lang::Pointer<Command> processSessionInfo(SessionInfo* info);
88 
89  virtual decaf::lang::Pointer<Command> processRemoveSession(SessionId* id);
90 
91  virtual decaf::lang::Pointer<Command> processConnectionInfo(ConnectionInfo* info);
92 
93  virtual decaf::lang::Pointer<Command> processRemoveConnection(ConnectionId* id);
94 
95  virtual decaf::lang::Pointer<Command> processMessage(Message* message);
96 
97  virtual decaf::lang::Pointer<Command> processBeginTransaction(TransactionInfo* info);
98 
99  virtual decaf::lang::Pointer<Command> processPrepareTransaction(TransactionInfo* info);
100 
101  virtual decaf::lang::Pointer<Command> processCommitTransactionOnePhase(TransactionInfo* info);
102 
103  virtual decaf::lang::Pointer<Command> processCommitTransactionTwoPhase(TransactionInfo* info);
104 
105  virtual decaf::lang::Pointer<Command> processRollbackTransaction(TransactionInfo* info);
106 
107  virtual decaf::lang::Pointer<Command> processEndTransaction(TransactionInfo* info);
108 
109  virtual decaf::lang::Pointer<Command> processMessagePull(MessagePull* pull);
110 
111  bool isRestoreConsumers() const {
112  return this->restoreConsumers;
113  }
114 
115  void setRestoreConsumers(bool restoreConsumers) {
116  this->restoreConsumers = restoreConsumers;
117  }
118 
119  bool isRestoreProducers() const {
120  return this->restoreProducers;
121  }
122 
123  void setRestoreProducers(bool restoreProducers) {
124  this->restoreProducers = restoreProducers;
125  }
126 
127  bool isRestoreSessions() const {
128  return this->restoreSessions;
129  }
130 
131  void setRestoreSessions(bool restoreSessions) {
132  this->restoreSessions = restoreSessions;
133  }
134 
135  bool isTrackTransactions() const {
136  return this->trackTransactions;
137  }
138 
139  void setTrackTransactions(bool trackTransactions) {
140  this->trackTransactions = trackTransactions;
141  }
142 
143  bool isRestoreTransaction() const {
144  return this->restoreTransaction;
145  }
146 
147  void setRestoreTransaction(bool restoreTransaction) {
148  this->restoreTransaction = restoreTransaction;
149  }
150 
151  bool isTrackMessages() const {
152  return this->trackMessages;
153  }
154 
155  void setTrackMessages(bool trackMessages) {
156  this->trackMessages = trackMessages;
157  }
158 
160  return this->maxMessageCacheSize;
161  }
162 
163  void setMaxMessageCacheSize(int maxMessageCacheSize) {
164  this->maxMessageCacheSize = maxMessageCacheSize;
165  }
166 
168  return this->maxMessagePullCacheSize;
169  }
170 
171  void setMaxMessagePullCacheSize(int maxMessagePullCacheSize) {
172  this->maxMessagePullCacheSize = maxMessagePullCacheSize;
173  }
174 
176  return this->trackTransactionProducers;
177  }
178 
179  void setTrackTransactionProducers(bool trackTransactionProducers) {
180  this->trackTransactionProducers = trackTransactionProducers;
181  }
182 
183  private:
184 
185  void doRestoreTransactions(decaf::lang::Pointer<transport::Transport> transport,
186  decaf::lang::Pointer<ConnectionState> connectionState);
187 
188  void doRestoreSessions(decaf::lang::Pointer<transport::Transport> transport,
189  decaf::lang::Pointer<ConnectionState> connectionState);
190 
191  void doRestoreConsumers(decaf::lang::Pointer<transport::Transport> transport,
193 
194  void doRestoreProducers(decaf::lang::Pointer<transport::Transport> transport,
196 
197  void doRestoreTempDestinations(decaf::lang::Pointer<transport::Transport> transport,
198  decaf::lang::Pointer<ConnectionState> connectionState);
199 
200  };
201 
202 }}
203 
204 #endif /*_ACTIVEMQ_STATE_CONNECTIONSTATETRACKER_H_*/
bool isRestoreConsumers() const
Definition: ConnectionStateTracker.h:111
int getMaxMessagePullCacheSize() const
Definition: ConnectionStateTracker.h:167
bool isRestoreTransaction() const
Definition: ConnectionStateTracker.h:143
Definition: ProducerId.h:48
bool isTrackMessages() const
Definition: ConnectionStateTracker.h:151
void setRestoreConsumers(bool restoreConsumers)
Definition: ConnectionStateTracker.h:115
Definition: ConnectionInfo.h:49
#define AMQCPP_API
Definition: Config.h:30
Definition: DestinationInfo.h:49
Definition: SessionInfo.h:48
Definition: ConnectionId.h:51
void setRestoreTransaction(bool restoreTransaction)
Definition: ConnectionStateTracker.h:147
void setTrackMessages(bool trackMessages)
Definition: ConnectionStateTracker.h:155
void setTrackTransactionProducers(bool trackTransactionProducers)
Definition: ConnectionStateTracker.h:179
bool isTrackTransactions() const
Definition: ConnectionStateTracker.h:135
Definition: MessagePull.h:49
Default Implementation of a CommandVisitor that returns NULL for all calls.
Definition: CommandVisitorAdapter.h:66
int getMaxMessageCacheSize() const
Definition: ConnectionStateTracker.h:159
Definition: ConsumerId.h:48
Interface for a transport layer for command objects.
Definition: Transport.h:59
Definition: ConsumerInfo.h:51
void setMaxMessagePullCacheSize(int maxMessagePullCacheSize)
Definition: ConnectionStateTracker.h:171
Definition: ConnectionStateTracker.h:41
bool isRestoreSessions() const
Definition: ConnectionStateTracker.h:127
Definition: Message.h:59
void setRestoreSessions(bool restoreSessions)
Definition: ConnectionStateTracker.h:131
bool isTrackTransactionProducers() const
Definition: ConnectionStateTracker.h:175
bool isRestoreProducers() const
Definition: ConnectionStateTracker.h:119
Definition: TransactionInfo.h:48
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements...
Definition: CachedConsumer.h:24
Definition: SessionId.h:51
void setTrackTransactions(bool trackTransactions)
Definition: ConnectionStateTracker.h:139
void setRestoreProducers(bool restoreProducers)
Definition: ConnectionStateTracker.h:123
Definition: ProducerInfo.h:50
Decaf&#39;s implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
void setMaxMessageCacheSize(int maxMessageCacheSize)
Definition: ConnectionStateTracker.h:163