diff options
-rw-r--r-- | qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp | 2 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/management/ManagementObject.cpp | 2 | ||||
-rw-r--r-- | qpid/extras/qmf/src/py/qmf/console.py | 22 |
3 files changed, 22 insertions, 4 deletions
diff --git a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp b/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp index 5966b0766c..5513379643 100644 --- a/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp +++ b/qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp @@ -576,7 +576,7 @@ void ManagementAgentImpl::handleGetQuery(const string& body, const string& cid, */ 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()) { diff --git a/qpid/cpp/src/qpid/management/ManagementObject.cpp b/qpid/cpp/src/qpid/management/ManagementObject.cpp index 68fcdaca71..6184ed0697 100644 --- a/qpid/cpp/src/qpid/management/ManagementObject.cpp +++ b/qpid/cpp/src/qpid/management/ManagementObject.cpp @@ -188,7 +188,7 @@ void ObjectId::mapDecode(const messaging::VariantMap& map) agentName = i->second.asString(); if ((i = map.find("_agent_epoch")) != map.end()) - agentEpoch = i->second.asUint64(); + agentEpoch = i->second.asInt64(); } diff --git a/qpid/extras/qmf/src/py/qmf/console.py b/qpid/extras/qmf/src/py/qmf/console.py index 4bbe69655e..d3cbf76dc7 100644 --- a/qpid/extras/qmf/src/py/qmf/console.py +++ b/qpid/extras/qmf/src/py/qmf/console.py @@ -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 |