You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2010/03/26 19:00:44 UTC

svn commit: r927994 - in /qpid/branches/qmf-devel0.7a/qpid: cpp/src/qpid/agent/ManagementAgentImpl.cpp cpp/src/qpid/management/ManagementObject.cpp extras/qmf/src/py/qmf/console.py

Author: tross
Date: Fri Mar 26 18:00:43 2010
New Revision: 927994

URL: http://svn.apache.org/viewvc?rev=927994&view=rev
Log:
Fixed bugs related to query-by-objectId

Modified:
    qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp
    qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/management/ManagementObject.cpp
    qpid/branches/qmf-devel0.7a/qpid/extras/qmf/src/py/qmf/console.py

Modified: qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp?rev=927994&r1=927993&r2=927994&view=diff
==============================================================================
--- qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp (original)
+++ qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp Fri Mar 26 18:00:43 2010
@@ -576,7 +576,7 @@ void ManagementAgentImpl::handleGetQuery
      */
     i = inMap.find("_object_id");
     if (i != inMap.end() && i->second.getType() == qpid::messaging::VAR_MAP) {
-        ObjectId objId(i->second);
+        ObjectId objId(i->second.asMap());
 
         ManagementObjectMap::iterator iter = managementObjects.find(objId);
         if (iter != managementObjects.end()) {

Modified: qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/management/ManagementObject.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/management/ManagementObject.cpp?rev=927994&r1=927993&r2=927994&view=diff
==============================================================================
--- qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/management/ManagementObject.cpp (original)
+++ qpid/branches/qmf-devel0.7a/qpid/cpp/src/qpid/management/ManagementObject.cpp Fri Mar 26 18:00:43 2010
@@ -188,7 +188,7 @@ void ObjectId::mapDecode(const messaging
         agentName = i->second.asString();
 
     if ((i = map.find("_agent_epoch")) != map.end())
-        agentEpoch = i->second.asUint64();
+        agentEpoch = i->second.asInt64();
 }
 
 

Modified: qpid/branches/qmf-devel0.7a/qpid/extras/qmf/src/py/qmf/console.py
URL: http://svn.apache.org/viewvc/qpid/branches/qmf-devel0.7a/qpid/extras/qmf/src/py/qmf/console.py?rev=927994&r1=927993&r2=927994&view=diff
==============================================================================
--- qpid/branches/qmf-devel0.7a/qpid/extras/qmf/src/py/qmf/console.py (original)
+++ qpid/branches/qmf-devel0.7a/qpid/extras/qmf/src/py/qmf/console.py Fri Mar 26 18:00:43 2010
@@ -1903,6 +1903,8 @@ class Broker:
       try:
         self.cv.acquire()
         agent = self.agents.pop(bankKey, None)
+        if agent:
+          agent.close()
       finally:
         self.cv.release()
       if agent and self.session.console:
@@ -1926,7 +1928,9 @@ class Broker:
         if self.agents[key].isOld():
           to_delete.append(key)
       for key in to_delete:
-        to_notify.append(self.agents.pop(key, None))
+        agent = self.agents.pop(key)
+        agent.close()
+        to_notify.append(agent)
     finally:
       self.cv.release()
     if self.session.console:
@@ -2159,6 +2163,12 @@ class Agent:
     self.contextMap = {}
     self.unsolicitedContext = RequestContext(self, self)
     self.lastSeenTime = time()
+    self.closed = None
+
+
+  def _checkClosed(self):
+    if self.closed:
+      raise Exception("Agent is disconnected")
 
 
   def __call__(self, **kwargs):
@@ -2185,6 +2195,10 @@ class Agent:
     return None
 
 
+  def close(self):
+    self.closed = True
+
+
   def __repr__(self):
     if self.isV2:
       ver = "v2"
@@ -2194,14 +2208,17 @@ class Agent:
 
 
   def getBroker(self):
+    self._checkClosed()
     return self.broker
 
 
   def getBrokerBank(self):
+    self._checkClosed()
     return self.brokerBank
 
 
   def getAgentBank(self):
+    self._checkClosed()
     return self.agentBank
 
 
@@ -2231,6 +2248,7 @@ class Agent:
     if the argument name="test" is supplied, only objects whose "name" property is "test"
     will be returned in the result.
     """
+    self._checkClosed()
     if notifiable:
       if not callable(notifiable):
         raise Exception("notifiable object must be callable")
@@ -2407,7 +2425,7 @@ class Agent:
     elif '_key' in kwargs:
       query['_schema_id'] = kwargs['_key'].asMap()
     elif '_objectId' in kwargs:
-      query['_object_id'] = kwargs['_objectId'].asMap
+      query['_object_id'] = kwargs['_objectId'].asMap()
 
     #
     # Construct and transmit the message



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