summaryrefslogtreecommitdiff
path: root/qpid/python/qmf
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2008-11-21 20:17:22 +0000
committerTed Ross <tross@apache.org>2008-11-21 20:17:22 +0000
commita00e575e242f6c5c9673948efc905226f5a0bfd2 (patch)
tree8fb608856ca15d5286541844a1dcd513bbd7030f /qpid/python/qmf
parent284d5014e4881605ee63f774a42bb54f05ea9f22 (diff)
downloadqpid-python-a00e575e242f6c5c9673948efc905226f5a0bfd2.tar.gz
Fixed several problems related to qmf update timestamps:
- Timestamps were set at update send time regardless of whether the object's contents were actually changed. Now timestamps are set at the time of the change. - Agent heartbeat messages are now being sent after periodic updates, not before. Cleaned up the Agent object in qmf.console. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@719699 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python/qmf')
-rw-r--r--qpid/python/qmf/console.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/qpid/python/qmf/console.py b/qpid/python/qmf/console.py
index 4e74cac4ee..8ccbefaf47 100644
--- a/qpid/python/qmf/console.py
+++ b/qpid/python/qmf/console.py
@@ -340,7 +340,7 @@ class Session:
self.cv.release()
broker._setHeader(sendCodec, 'G', seq)
sendCodec.write_map(map)
- smsg = broker._message(sendCodec.encoded, "agent.%s" % agent.bank)
+ smsg = broker._message(sendCodec.encoded, "agent.%d.%d" % (agent.brokerBank, agent.agentBank))
broker._send(smsg)
starttime = time()
@@ -507,7 +507,7 @@ class Session:
agent = broker.getAgent(brokerBank, agentBank)
timestamp = codec.read_uint64()
- if self.console != None:
+ if self.console != None and agent != None:
self.console.heartbeat(agent, timestamp)
def _handleEventInd(self, broker, codec, seq):
@@ -1135,7 +1135,7 @@ class Broker:
self.authPass = authPass
self.topicCredits = topicCredits
self.agents = {}
- self.agents["1.0"] = Agent(self, "1.0", "BrokerAgent")
+ self.agents[(1,0)] = Agent(self, 0, "BrokerAgent")
self.topicBound = False
self.cv = Condition()
self.syncInFlight = False
@@ -1162,7 +1162,7 @@ class Broker:
return 1
def getAgent(self, brokerBank, agentBank):
- bankKey = "%d.%d" % (brokerBank, agentBank)
+ bankKey = (brokerBank, agentBank)
if bankKey in self.agents:
return self.agents[bankKey]
return None
@@ -1250,10 +1250,10 @@ class Broker:
self.error = "Connect Failed %d - %s" % (e[0], e[1])
def _updateAgent(self, obj):
- bankKey = "%d.%d" % (obj.brokerBank, obj.agentBank)
+ bankKey = (obj.brokerBank, obj.agentBank)
if obj._deleteTime == 0:
if bankKey not in self.agents:
- agent = Agent(self, bankKey, obj.label)
+ agent = Agent(self, obj.agentBank, obj.label)
self.agents[bankKey] = agent
if self.session.console != None:
self.session.console.newAgent(agent)
@@ -1377,19 +1377,23 @@ class Broker:
class Agent:
""" """
- def __init__(self, broker, bank, label):
+ def __init__(self, broker, agentBank, label):
self.broker = broker
- self.bank = bank
- self.label = label
+ self.brokerBank = broker.getBrokerBank()
+ self.agentBank = agentBank
+ self.label = label
def __repr__(self):
- return "Agent at bank %s (%s)" % (self.bank, self.label)
+ return "Agent at bank %d.%d (%s)" % (self.brokerBank, self.agentBank, self.label)
def getBroker(self):
return self.broker
+ def getBrokerBank(self):
+ return self.brokerBank
+
def getAgentBank(self):
- return self.bank
+ return self.agentBank
class Event:
""" """