Author: tabish
Date: Sat Feb 14 17:42:57 2009
New Revision: 744548
URL: http://svn.apache.org/viewvc?rev=744548&view=rev
Log:
Implementation of more State Tracking now that the Collections API is more
defined.
Modified:
activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h
activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h?rev=744548&r1=744547&r2=744548&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/ConnectionState.h Sat
Feb 14 17:42:57 2009
@@ -106,20 +106,20 @@
// Collection<TransactionState> getTransactionStates() {
// return transactions.values();
// }
-//
-// TransactionState removeTransactionState(TransactionId id) {
-// return transactions.remove(id);
-// }
-//
+
+ Pointer<TransactionState> removeTransactionState( const
Pointer<TransactionId>& id ) {
+ return transactions.remove( id );
+ }
+
void addSession( const Pointer<SessionInfo>& info ) {
checkShutdown();
sessions.put(
info->getSessionId(), Pointer<SessionState>( new SessionState(
info ) ) );
}
-// SessionState removeSession(SessionId id) {
-// return sessions.remove(id);
-// }
+ Pointer<SessionState> removeSession( const Pointer<SessionId>& id ) {
+ return sessions.remove( id );
+ }
const Pointer<SessionState>& getSessionState( const
Pointer<SessionId>& id ) const {
return sessions.get( id );
Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h?rev=744548&r1=744547&r2=744548&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/SessionState.h Sat Feb
14 17:42:57 2009
@@ -26,7 +26,7 @@
#include <activemq/state/ProducerState.h>
#include <decaf/util/concurrent/atomic/AtomicBoolean.h>
-#include <decaf/util/StlMap.h>
+#include <decaf/util/concurrent/ConcurrentStlMap.h>
#include <string>
#include <memory>
@@ -34,23 +34,25 @@
namespace activemq {
namespace state {
+ using decaf::lang::Pointer;
+ using decaf::util::concurrent::ConcurrentStlMap;
+ using decaf::util::concurrent::atomic::AtomicBoolean;
using namespace activemq::commands;
- using namespace decaf::lang;
class AMQCPP_API SessionState {
private:
Pointer<SessionInfo> info;
- decaf::util::StlMap< Pointer<ProducerId>,
- Pointer<ProducerState>,
- ProducerId::COMPARATOR > producers;
-
- decaf::util::StlMap< Pointer<ConsumerId>,
- Pointer<ConsumerState>,
- ConsumerId::COMPARATOR > consumers;
+ ConcurrentStlMap< Pointer<ProducerId>,
+ Pointer<ProducerState>,
+ ProducerId::COMPARATOR > producers;
+
+ ConcurrentStlMap< Pointer<ConsumerId>,
+ Pointer<ConsumerState>,
+ ConsumerId::COMPARATOR > consumers;
- decaf::util::concurrent::atomic::AtomicBoolean disposed;
+ AtomicBoolean disposed;
public:
@@ -64,24 +66,26 @@
return this->info;
}
-// void addProducer(commands::ProducerInfo info) {
-// checkShutdown();
-// producers.put(info.getProducerId(), new ProducerState(info));
-// }
-//
-// ProducerState removeProducer(commands::ProducerId id) {
-// return producers.remove(id);
-// }
-//
-// void addConsumer(commands::ConsumerInfo info) {
-// checkShutdown();
-// consumers.put(info.getConsumerId(), new ConsumerState(info));
-// }
-//
-// ConsumerState removeConsumer(commands::ConsumerId id) {
-// return consumers.remove(id);
-// }
-//
+ void addProducer( const Pointer<ProducerInfo>& info ) {
+ checkShutdown();
+ producers.put( info->getProducerId(),
+ Pointer<ProducerState>( new ProducerState( info ) ) );
+ }
+
+ Pointer<ProducerState> removeProducer( const Pointer<ProducerId>& id) {
+ return producers.remove( id );
+ }
+
+ void addConsumer( const Pointer<ConsumerInfo>& info ) {
+ checkShutdown();
+ consumers.put( info->getConsumerId(),
+ Pointer<ConsumerState>( new ConsumerState( info ) ) );
+ }
+
+ Pointer<ConsumerState> removeConsumer( const Pointer<ConsumerId>& id )
{
+ return consumers.remove( id );
+ }
+
// Set<commands::ConsumerId> getConsumerIds() {
// return consumers.keySet();
// }
@@ -93,18 +97,18 @@
// Collection<ProducerState> getProducerStates() {
// return producers.values();
// }
-//
-// ProducerState getProducerState(commands::ProducerId producerId) {
-// return producers.get(producerId);
-// }
-//
+
+ Pointer<ProducerState> getProducerState( const Pointer<ProducerId>& id
) {
+ return producers.get( id );
+ }
+
// Collection<ConsumerState> getConsumerStates() {
// return consumers.values();
// }
-//
-// ConsumerState getConsumerState( const commands::ConsumerId&
consumerId) {
-// return consumers.get(consumerId);
-// }
+
+ Pointer<ConsumerState> getConsumerState( const Pointer<ConsumerId>& id
) {
+ return consumers.get( id );
+ }
void checkShutdown() const;
Modified: activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
URL:
http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h?rev=744548&r1=744547&r2=744548&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h
(original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/state/TransactionState.h Sat
Feb 14 17:42:57 2009
@@ -32,24 +32,29 @@
namespace activemq {
namespace state {
+ using decaf::lang::Pointer;
+ using decaf::util::StlList;
+ using decaf::util::concurrent::atomic::AtomicBoolean;
+ using namespace activemq::commands;
+
class AMQCPP_API TransactionState {
private:
- decaf::util::StlList< decaf::lang::Pointer<commands::Command> >
commands;
- decaf::lang::Pointer<commands::TransactionId> id;
- decaf::util::concurrent::atomic::AtomicBoolean disposed;
+ StlList< Pointer<Command> > commands;
+ Pointer<TransactionId> id;
+ AtomicBoolean disposed;
bool prepared;
int preparedResult;
public:
- TransactionState( const decaf::lang::Pointer<commands::TransactionId>&
id );
+ TransactionState( const Pointer<TransactionId>& id );
virtual ~TransactionState();
std::string toString() const;
- void addCommand( const decaf::lang::Pointer< commands::Command >&
operation );
+ void addCommand( const Pointer<Command>& operation );
void checkShutdown() const;
@@ -57,11 +62,11 @@
this->disposed.set( true );
}
- const decaf::util::List<decaf::lang::Pointer< commands::Command > >&
getCommands() {
+ const decaf::util::List< Pointer<Command> >& getCommands() {
return commands;
}
- const decaf::lang::Pointer<commands::TransactionId>& getId() const {
+ const Pointer<TransactionId>& getId() const {
return id;
}