activemq-cpp-3.8.2
ConnectionState.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_CONNECTIONSTATE_H_
19 #define _ACTIVEMQ_STATE_CONNECTIONSTATE_H_
20 
21 #include <activemq/util/Config.h>
33 
34 #include <decaf/util/StlMap.h>
37 #include <decaf/util/LinkedList.h>
38 #include <decaf/lang/Pointer.h>
39 
40 #include <string>
41 
42 namespace activemq {
43 namespace state {
44 
46  using namespace decaf::util;
47  using namespace activemq::commands;
48 
50  private:
51 
55  LocalTransactionId::COMPARATOR > transactions;
58  SessionId::COMPARATOR > sessions;
59  LinkedList< Pointer<DestinationInfo> > tempDestinations;
61 
62  bool connectionInterruptProcessingComplete;
65  ConsumerId::COMPARATOR > recoveringPullConsumers;
66 
67  public:
68 
70 
71  virtual ~ConnectionState();
72 
73  std::string toString() const;
74 
76  return this->info;
77  }
78 
79  void checkShutdown() const;
80 
81  void shutdown();
82 
83  void reset(Pointer<ConnectionInfo> info);
84 
86  checkShutdown();
87  tempDestinations.add(info);
88  }
89 
90  void removeTempDestination(Pointer<ActiveMQDestination> destination);
91 
93  checkShutdown();
94  transactions.put(id.dynamicCast<LocalTransactionId>(), Pointer<TransactionState>(new TransactionState(id)));
95  }
96 
98  return transactions.get(id.dynamicCast<LocalTransactionId>());
99  }
100 
102  return transactions.values();
103  }
104 
106  return transactions.remove(id.dynamicCast<LocalTransactionId>());
107  }
108 
110  checkShutdown();
111  sessions.put(info->getSessionId(), Pointer<SessionState>(new SessionState(info)));
112  }
113 
115  return sessions.remove(id);
116  }
117 
119  return sessions.get(id);
120  }
121 
123  return tempDestinations;
124  }
125 
127  return sessions.values();
128  }
129 
131  return recoveringPullConsumers;
132  }
133 
134  void setConnectionInterruptProcessingComplete(bool connectionInterruptProcessingComplete) {
135  this->connectionInterruptProcessingComplete = connectionInterruptProcessingComplete;
136  }
137 
139  return this->connectionInterruptProcessingComplete;
140  }
141 
142  };
143 
144 }}
145 
146 #endif /*_ACTIVEMQ_STATE_CONNECTIONSTATE_H_*/
StlMap< Pointer< ConsumerId >, Pointer< ConsumerInfo >, ConsumerId::COMPARATOR > & getRecoveringPullConsumers()
Definition: ConnectionState.h:130
The root interface in the collection hierarchy.
Definition: Collection.h:68
const Pointer< commands::ConnectionInfo > getInfo() const
Definition: ConnectionState.h:75
const Pointer< TransactionState > & getTransactionState(Pointer< TransactionId > id) const
Definition: ConnectionState.h:97
virtual const Pointer< SessionId > & getSessionId() const
const decaf::util::Collection< Pointer< TransactionState > > & getTransactionStates() const
Definition: ConnectionState.h:101
const LinkedList< Pointer< DestinationInfo > > & getTempDesinations() const
Definition: ConnectionState.h:122
#define AMQCPP_API
Definition: Config.h:30
Map template that wraps around a std::map to provide a more user-friendly interface and to provide co...
Definition: StlMap.h:47
void addSession(Pointer< SessionInfo > info)
Definition: ConnectionState.h:109
Definition: TransactionState.h:45
Map template that wraps around a std::map to provide a more user-friendly interface and to provide co...
Definition: ConcurrentStlMap.h:51
void addTransactionState(Pointer< TransactionId > id)
Definition: ConnectionState.h:92
void addTempDestination(Pointer< DestinationInfo > info)
Definition: ConnectionState.h:85
void setConnectionInterruptProcessingComplete(bool connectionInterruptProcessingComplete)
Definition: ConnectionState.h:134
A boolean value that may be updated atomically.
Definition: AtomicBoolean.h:34
bool isConnectionInterruptProcessingComplete()
Definition: ConnectionState.h:138
const Pointer< SessionState > getSessionState(Pointer< SessionId > id) const
Definition: ConnectionState.h:118
Definition: SessionState.h:41
This implementation of Comparator is designed to allows objects in a Collection to be sorted or teste...
Definition: Pointer.h:366
Definition: ConnectionState.h:49
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
Pointer< TransactionState > removeTransactionState(Pointer< TransactionId > id)
Definition: ConnectionState.h:105
const decaf::util::Collection< Pointer< SessionState > > & getSessionStates() const
Definition: ConnectionState.h:126
Pointer< SessionState > removeSession(Pointer< SessionId > id)
Definition: ConnectionState.h:114
A complete implementation of the List interface using a doubly linked list data structure.
Definition: LinkedList.h:55