qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1145557 - in /qpid/trunk/qpid/cpp/src/qmf: Agent.cpp AgentImpl.h ConsoleSession.cpp ConsoleSessionImpl.h
Date Tue, 12 Jul 2011 11:49:33 GMT
Author: tross
Date: Tue Jul 12 11:49:32 2011
New Revision: 1145557

URL: http://svn.apache.org/viewvc?rev=1145557&view=rev
Log:
QPID-3275 - QMF Console asynchronous correlation-id should be scoped to the session, not the
specific agent

Modified:
    qpid/trunk/qpid/cpp/src/qmf/Agent.cpp
    qpid/trunk/qpid/cpp/src/qmf/AgentImpl.h
    qpid/trunk/qpid/cpp/src/qmf/ConsoleSession.cpp
    qpid/trunk/qpid/cpp/src/qmf/ConsoleSessionImpl.h

Modified: qpid/trunk/qpid/cpp/src/qmf/Agent.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/Agent.cpp?rev=1145557&r1=1145556&r2=1145557&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/Agent.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/Agent.cpp Tue Jul 12 11:49:32 2011
@@ -72,7 +72,7 @@ Schema Agent::getSchema(const SchemaId& 
 
 AgentImpl::AgentImpl(const std::string& n, uint32_t e, ConsoleSessionImpl& s) :
     name(n), directSubject(n), epoch(e), session(s), touched(true), untouchedCount(0), capability(0),
-    sender(session.directSender), nextCorrelator(1), schemaCache(s.schemaCache)
+    sender(session.directSender), schemaCache(s.schemaCache)
 {
 }
 
@@ -102,12 +102,11 @@ const Variant& AgentImpl::getAttribute(c
 ConsoleEvent AgentImpl::query(const Query& query, Duration timeout)
 {
     boost::shared_ptr<SyncContext> context(new SyncContext());
-    uint32_t correlator;
+    uint32_t correlator(session.correlator());
     ConsoleEvent result;
 
     {
         qpid::sys::Mutex::ScopedLock l(lock);
-        correlator = nextCorrelator++;
         contextMap[correlator] = context;
     }
     try {
@@ -151,12 +150,7 @@ ConsoleEvent AgentImpl::query(const stri
 
 uint32_t AgentImpl::queryAsync(const Query& query)
 {
-    uint32_t correlator;
-
-    {
-        qpid::sys::Mutex::ScopedLock l(lock);
-        correlator = nextCorrelator++;
-    }
+    uint32_t correlator(session.correlator());
 
     sendQuery(query, correlator);
     return correlator;
@@ -172,12 +166,11 @@ uint32_t AgentImpl::queryAsync(const str
 ConsoleEvent AgentImpl::callMethod(const string& method, const Variant::Map& args,
const DataAddr& addr, Duration timeout)
 {
     boost::shared_ptr<SyncContext> context(new SyncContext());
-    uint32_t correlator;
+    uint32_t correlator(session.correlator());
     ConsoleEvent result;
 
     {
         qpid::sys::Mutex::ScopedLock l(lock);
-        correlator = nextCorrelator++;
         contextMap[correlator] = context;
     }
     try {
@@ -213,12 +206,7 @@ ConsoleEvent AgentImpl::callMethod(const
 
 uint32_t AgentImpl::callMethodAsync(const string& method, const Variant::Map& args,
const DataAddr& addr)
 {
-    uint32_t correlator;
-
-    {
-        qpid::sys::Mutex::ScopedLock l(lock);
-        correlator = nextCorrelator++;
-    }
+    uint32_t correlator(session.correlator());
 
     sendMethod(method, args, addr, correlator);
     return correlator;
@@ -596,12 +584,7 @@ void AgentImpl::sendMethod(const string&
 
 void AgentImpl::sendSchemaRequest(const SchemaId& id)
 {
-    uint32_t correlator;
-
-    {
-        qpid::sys::Mutex::ScopedLock l(lock);
-        correlator = nextCorrelator++;
-    }
+    uint32_t correlator(session.correlator());
 
     if (capability >= AGENT_CAPABILITY_V2_SCHEMA) {
         Query query(QUERY_SCHEMA, id);

Modified: qpid/trunk/qpid/cpp/src/qmf/AgentImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/AgentImpl.h?rev=1145557&r1=1145556&r2=1145557&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/AgentImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/AgentImpl.h Tue Jul 12 11:49:32 2011
@@ -99,7 +99,6 @@ namespace qmf {
         uint32_t capability;
         qpid::messaging::Sender sender;
         qpid::types::Variant::Map attributes;
-        uint32_t nextCorrelator;
         std::map<uint32_t, boost::shared_ptr<SyncContext> > contextMap;
         boost::shared_ptr<SchemaCache> schemaCache;
         mutable std::set<std::string> packageSet;

Modified: qpid/trunk/qpid/cpp/src/qmf/ConsoleSession.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ConsoleSession.cpp?rev=1145557&r1=1145556&r2=1145557&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ConsoleSession.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ConsoleSession.cpp Tue Jul 12 11:49:32 2011
@@ -68,7 +68,7 @@ Subscription ConsoleSession::subscribe(c
 ConsoleSessionImpl::ConsoleSessionImpl(Connection& c, const string& options) :
     connection(c), domain("default"), maxAgentAgeMinutes(5), listenOnDirect(true), strictSecurity(false),
     opened(false), thread(0), threadCanceled(false), lastVisit(0), lastAgePass(0),
-    connectedBrokerInAgentList(false), schemaCache(new SchemaCache())
+    connectedBrokerInAgentList(false), schemaCache(new SchemaCache()), nextCorrelator(1)
 {
     if (!options.empty()) {
         qpid::messaging::AddressParser parser(options);

Modified: qpid/trunk/qpid/cpp/src/qmf/ConsoleSessionImpl.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qmf/ConsoleSessionImpl.h?rev=1145557&r1=1145556&r2=1145557&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qmf/ConsoleSessionImpl.h (original)
+++ qpid/trunk/qpid/cpp/src/qmf/ConsoleSessionImpl.h Tue Jul 12 11:49:32 2011
@@ -90,6 +90,8 @@ namespace qmf {
         std::string directBase;
         std::string topicBase;
         boost::shared_ptr<SchemaCache> schemaCache;
+        qpid::sys::Mutex corrlock;
+        uint32_t nextCorrelator;
 
         void enqueueEvent(const ConsoleEvent&);
         void enqueueEventLH(const ConsoleEvent&);
@@ -100,6 +102,7 @@ namespace qmf {
         void handleV1SchemaResponse(qpid::management::Buffer&, uint32_t, const qpid::messaging::Message&);
         void periodicProcessing(uint64_t);
         void run();
+        uint32_t correlator() { qpid::sys::Mutex::ScopedLock l(corrlock); return nextCorrelator++;
}
 
         friend class AgentImpl;
     };



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message