summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2010-03-26 18:00:43 +0000
committerTed Ross <tross@apache.org>2010-03-26 18:00:43 +0000
commitb58c5c0d249f627dbf3eecc542b8cad4a489d7fa (patch)
tree312a334da73e563b4f49c2e0775219dc8944e5e4
parent0c72a9c689407001ab0ccab00d091166b93ed9ec (diff)
downloadqpid-python-b58c5c0d249f627dbf3eecc542b8cad4a489d7fa.tar.gz
Fixed bugs related to query-by-objectId
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qmf-devel0.7a@927994 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/agent/ManagementAgentImpl.cpp2
-rw-r--r--qpid/cpp/src/qpid/management/ManagementObject.cpp2
-rw-r--r--qpid/extras/qmf/src/py/qmf/console.py22
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