rhmessaging commits: r1277 - mgmt/mint/xml.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2007-11-08 17:03:47 -0500 (Thu, 08 Nov 2007)
New Revision: 1277
Added:
mgmt/mint/xml/MgmtTypes.xml
Modified:
mgmt/mint/xml/MgmtSchema.xml
Log:
Updated format of XML, added type spec
Modified: mgmt/mint/xml/MgmtSchema.xml
===================================================================
--- mgmt/mint/xml/MgmtSchema.xml 2007-11-08 21:46:00 UTC (rev 1276)
+++ mgmt/mint/xml/MgmtSchema.xml 2007-11-08 22:03:47 UTC (rev 1277)
@@ -44,59 +44,64 @@
System
===============================================================
-->
- <object name="system" schemaId="1">
- <configElement name="sysId" index="y" type="string"/>
+ <class name="system" schemaId="1">
+ <configElement name="sysId" index="y" type="sstr" access="RC"/>
<!-- RT config/instrumentation TBD -->
- </object>
+ </class>
<!--
===============================================================
Broker
===============================================================
-->
- <object name="broker" schemaId="2">
- <configElement name="systemRef" type="objId" access="RO" index="y" desc="System ID"/>
- <configElement name="port" type="uint16" access="RO" index="y" desc="TCP Port for AMQP Service"/>
+ <class name="broker" schemaId="2">
+ <configElement name="systemRef" type="objId" access="RC" index="y" desc="System ID"/>
+ <configElement name="port" type="uint16" access="RC" index="y" desc="TCP Port for AMQP Service"/>
<configElement name="workerThreads" type="uint16" access="RO" desc="Thread pool size"/>
<configElement name="maxConns" type="uint16" access="RO" desc="Maximum allowed connections"/>
<configElement name="connBacklog" type="uint16" access="RO" desc="Connection backlog limit for listening socket"/>
<configElement name="stagingThreshold" type="uint32" access="RO" desc="Broker stages messages over this size to disk"/>
- <configElement name="storeLib" type="string" access="RO" desc="Name of persistent storage library"/>
+ <configElement name="storeLib" type="sstr" access="RO" desc="Name of persistent storage library"/>
<configElement name="asyncStore" type="bool" access="RO" desc="Use async persistent store"/>
<configElement name="mgmtPubInterval" type="uint16" min="1" access="RW" unit="second" desc="Interval for management broadcasts"/>
<configElement name="initialDiskPageSize" type="uint32" access="RO" desc="Number of disk pages allocated for storage"/>
<configElement name="initialPagesPerQueue" type="uint32" access="RO" desc="Number of disk pages allocated per queue"/>
- <configElement name="clusterName" type="string" access="RO"
+ <configElement name="clusterName" type="sstr" access="RO"
desc="Name of cluster this server is a member of, zero-length for standalone server"/>
- <configElement name="version" type="string" access="RO" desc="Running software version"/>
+ <configElement name="version" type="sstr" access="RO" desc="Running software version"/>
<method name="joinCluster">
- <arg name="clusterName" type="string"/>
+ <arg name="clusterName" dir="I" type="sstr"/>
</method>
<method name="leaveCluster"/>
- </object>
+ <method name="echo">
+ <arg name="sequence" dir="IO" type="uint32" default="0"/>
+ <arg name="body" dir="IO" type="lstr" default=""/>
+ </method>
+ </class>
+
<!--
===============================================================
Virtual Host
===============================================================
-->
- <object name="vhost" schemaId="3">
+ <class name="vhost" schemaId="3">
<configElement name="brokerRef" type="objId" access="RC" index="y"/>
- <configElement name="name" type="string" access="RC" index="y"/>
- </object>
+ <configElement name="name" type="sstr" access="RC" index="y"/>
+ </class>
<!--
===============================================================
Queue
===============================================================
-->
- <object name="queue" schemaId="4">
+ <class name="queue" schemaId="4">
<configElement name="vhostRef" type="objId" access="RC" index="y"/>
- <configElement name="name" type="string" access="RC" index="y"/>
+ <configElement name="name" type="sstr" access="RC" index="y"/>
<configElement name="durable" type="bool" access="RC"/>
<configElement name="autoDelete" type="bool" access="RC"/>
@@ -107,163 +112,162 @@
<instElement name="diskPages" type="uint32"/>
<instElement name="diskAvailableSize" type="uint32"/>
- <instElement name="msgTotalEnqueues" type="uint64" unit="message" desc="Total messages enqueued"/>
- <instElement name="msgTotalDequeues" type="uint64" unit="message" desc="Total messages dequeued"/>
- <instElement name="msgTxnEnqueues" type="uint64" unit="message" desc="Transactional messages enqueued"/>
- <instElement name="msgTxnDequeues" type="uint64" unit="message" desc="Transactional messages dequeued"/>
- <instElement name="msgPersistEnqueues" type="uint64" unit="message" desc="Persistent messages enqueued"/>
- <instElement name="msgPersistDequeues" type="uint64" unit="message" desc="Persistent messages dequeued"/>
- <instElement name="msgDepth" type="uint32_wm" unit="message" desc="Current size of queue in messages"/>
- <instElement name="byteTotalEnqueues" type="uint64" unit="octet" desc="Total messages enqueued"/>
- <instElement name="byteTotalDequeues" type="uint64" unit="octet" desc="Total messages dequeued"/>
- <instElement name="byteTxnEnqueues" type="uint64" unit="octet" desc="Transactional messages enqueued"/>
- <instElement name="byteTxnDequeues" type="uint64" unit="octet" desc="Transactional messages dequeued"/>
- <instElement name="bytePersistEnqueues" type="uint64" unit="octet" desc="Persistent messages enqueued"/>
- <instElement name="bytePersistDequeues" type="uint64" unit="octet" desc="Persistent messages dequeued"/>
- <instElement name="byteDepth" type="uint32_wm" unit="octet" desc="Current size of queue in bytes"/>
- <instElement name="enqueueTxnStarts" type="uint64" unit="transaction" desc="Total enqueue transactions started "/>
- <instElement name="enqueueTxnCommits" type="uint64" unit="transaction" desc="Total enqueue transactions committed"/>
- <instElement name="enqueueTxnRejects" type="uint64" unit="transaction" desc="Total enqueue transactions rejected"/>
- <instElement name="enqueueTxnCount" type="uint32_wm" unit="transaction" desc="Current pending enqueue transactions"/>
- <instElement name="dequeueTxnStarts" type="uint64" unit="transaction" desc="Total dequeue transactions started"/>
- <instElement name="dequeueTxnCommits" type="uint64" unit="transaction" desc="Total dequeue transactions committed"/>
- <instElement name="dequeueTxnRejects" type="uint64" unit="transaction" desc="Total dequeue transactions rejected"/>
- <instElement name="dequeueTxnCount" type="uint32_wm" unit="transaction" desc="Current pending dequeue transactions"/>
- <instElement name="consumers" type="uint32_wm" unit="consumer" desc="Current consumers on queue"/>
- <instElement name="bindings" type="uint32_wm" unit="binding" desc="Current bindings"/>
- <instElement name="unackedMessages" type="uint32_wm" unit="message" desc="Messages consumed but not yet acked"/>
+ <instElement name="msgTotalEnqueues" type="count64" unit="message" desc="Total messages enqueued"/>
+ <instElement name="msgTotalDequeues" type="count64" unit="message" desc="Total messages dequeued"/>
+ <instElement name="msgTxnEnqueues" type="count64" unit="message" desc="Transactional messages enqueued"/>
+ <instElement name="msgTxnDequeues" type="count64" unit="message" desc="Transactional messages dequeued"/>
+ <instElement name="msgPersistEnqueues" type="count64" unit="message" desc="Persistent messages enqueued"/>
+ <instElement name="msgPersistDequeues" type="count64" unit="message" desc="Persistent messages dequeued"/>
+ <instElement name="msgDepth" type="hilo32" unit="message" desc="Current size of queue in messages"/>
+ <instElement name="byteTotalEnqueues" type="count64" unit="octet" desc="Total messages enqueued"/>
+ <instElement name="byteTotalDequeues" type="count64" unit="octet" desc="Total messages dequeued"/>
+ <instElement name="byteTxnEnqueues" type="count64" unit="octet" desc="Transactional messages enqueued"/>
+ <instElement name="byteTxnDequeues" type="count64" unit="octet" desc="Transactional messages dequeued"/>
+ <instElement name="bytePersistEnqueues" type="count64" unit="octet" desc="Persistent messages enqueued"/>
+ <instElement name="bytePersistDequeues" type="count64" unit="octet" desc="Persistent messages dequeued"/>
+ <instElement name="byteDepth" type="hilo32" unit="octet" desc="Current size of queue in bytes"/>
+ <instElement name="enqueueTxnStarts" type="count64" unit="transaction" desc="Total enqueue transactions started "/>
+ <instElement name="enqueueTxnCommits" type="count64" unit="transaction" desc="Total enqueue transactions committed"/>
+ <instElement name="enqueueTxnRejects" type="count64" unit="transaction" desc="Total enqueue transactions rejected"/>
+ <instElement name="enqueueTxnCount" type="hilo32" unit="transaction" desc="Current pending enqueue transactions"/>
+ <instElement name="dequeueTxnStarts" type="count64" unit="transaction" desc="Total dequeue transactions started"/>
+ <instElement name="dequeueTxnCommits" type="count64" unit="transaction" desc="Total dequeue transactions committed"/>
+ <instElement name="dequeueTxnRejects" type="count64" unit="transaction" desc="Total dequeue transactions rejected"/>
+ <instElement name="dequeueTxnCount" type="hilo32" unit="transaction" desc="Current pending dequeue transactions"/>
+ <instElement name="consumers" type="hilo32" unit="consumer" desc="Current consumers on queue"/>
+ <instElement name="bindings" type="hilo32" unit="binding" desc="Current bindings"/>
+ <instElement name="unackedMessages" type="hilo32" unit="message" desc="Messages consumed but not yet acked"/>
<method name="purge" desc="Discard all messages on queue"/>
<method name="increaseDiskSize" desc="Increase number of disk pages allocated for this queue">
- <arg name="pages" type="uint32" desc="New total page allocation"/>
+ <arg name="pages" type="uint32" dir="I" desc="New total page allocation"/>
</method>
- </object>
+ </class>
<!--
===============================================================
Exchange
===============================================================
-->
- <object name="exchange" schemaId="5">
+ <class name="exchange" schemaId="5">
<configElement name="vhostRef" type="objId" access="RC" index="y"/>
- <configElement name="name" type="string" access="RC" index="y"/>
- <configElement name="type" type="string" access="RC"/>
+ <configElement name="name" type="sstr" access="RC" index="y"/>
+ <configElement name="type" type="sstr" access="RC"/>
- <instElement name="producers" type="uint32_wm" desc="Current producers on exchange"/>
- <instElement name="bindings" type="uint32_wm" desc="Current bindings"/>
- <instElement name="msgReceives" type="uint64" desc="Total messages received"/>
- <instElement name="msgDrops" type="uint64" desc="Total messages dropped (no matching key)"/>
- <instElement name="msgRoutes" type="uint64" desc="Total routed messages"/>
- <instElement name="byteReceives" type="uint64" desc="Total bytes received"/>
- <instElement name="byteDrops" type="uint64" desc="Total bytes dropped (no matching key)"/>
- <instElement name="byteRoutes" type="uint64" desc="Total routed bytes"/>
- </object>
+ <instElement name="producers" type="hilo32" desc="Current producers on exchange"/>
+ <instElement name="bindings" type="hilo32" desc="Current bindings"/>
+ <instElement name="msgReceives" type="count64" desc="Total messages received"/>
+ <instElement name="msgDrops" type="count64" desc="Total messages dropped (no matching key)"/>
+ <instElement name="msgRoutes" type="count64" desc="Total routed messages"/>
+ <instElement name="byteReceives" type="count64" desc="Total bytes received"/>
+ <instElement name="byteDrops" type="count64" desc="Total bytes dropped (no matching key)"/>
+ <instElement name="byteRoutes" type="count64" desc="Total routed bytes"/>
+ </class>
<!--
===============================================================
Binding
===============================================================
-->
- <object name="binding" schemaId="6">
- <configElement name="queueRef" type="objId" access="RC" index="y"/>
- <configElement name="exchangeRef" type="objId" access="RC" index="y"/>
- <configElement name="bindingKey" type="string" access="RC"/>
- <configElement name="arguments" type="fieldTable" access="RC"/>
+ <class name="binding" schemaId="6">
+ <configElement name="queueRef" type="objId" access="RC" index="y"/>
+ <configElement name="exchangeRef" type="objId" access="RC" index="y"/>
+ <configElement name="bindingKey" type="sstr" access="RC"/>
+<!--<configElement name="arguments" type="fieldTable" access="RC"/> -->
- <instElement name="msgMatched" type="uint64"/>
- </object>
+ <instElement name="msgMatched" type="count64"/>
+ </class>
<!--
===============================================================
Client
===============================================================
-->
- <object name="client" schemaId="7">
- <configElement name="vhostRef" type="objId" index="y"/>
- <configElement name="ipAddr" type="ipAddress" index="y"/>
- <configElement name="port" type="uint16" index="y"/>
+ <class name="client" schemaId="7">
+ <configElement name="vhostRef" type="objId" access="RC" index="y"/>
+ <configElement name="ipAddr" type="uint32" access="RC" index="y"/>
+ <configElement name="port" type="uint16" access="RC" index="y"/>
- <instElement name="authIdentity" type="string"/>
- <instElement name="msgsProduced" type="uint64"/>
- <instElement name="msgsConsumed" type="uint64"/>
- <instElement name="bytesProduced" type="uint64"/>
- <instElement name="bytesConsumed" type="uint64"/>
+ <instElement name="authIdentity" type="sstr"/>
+ <instElement name="msgsProduced" type="count64"/>
+ <instElement name="msgsConsumed" type="count64"/>
+ <instElement name="bytesProduced" type="count64"/>
+ <instElement name="bytesConsumed" type="count64"/>
<method name="close"/>
<method name="detach"/>
- </object>
+ </class>
<!--
===============================================================
Session
===============================================================
-->
- <object name="session" schemaId="8">
+ <class name="session" schemaId="8">
<configElement name="vhostRef" type="objId" index="y"/>
- <configElement name="name" type="string" index="y"/>
- <configElement name="clientRef" type="string" access="RO"/>
+ <configElement name="name" type="sstr" index="y"/>
+ <configElement name="clientRef" type="sstr" access="RO"/>
<configElement name="detachedLifespan" type="uint32" access="RO"/>
<instElement name="attached" type="bool"/>
- <instElement name="remainingLifespan" type="uint32"/>
- <instElement name="framesOutstanding" type="uint32"/>
+ <instElement name="remainingLifespan" type="count32"/>
+ <instElement name="framesOutstanding" type="count32"/>
<method name="solicitAck"/>
<method name="detach"/>
<method name="resetLifespan"/>
<method name="close"/>
- </object>
+ </class>
<!--
===============================================================
Destination
===============================================================
-->
- <object name="destination" schemaId="9">
+ <class name="destination" schemaId="9">
<configElement name="sessionRef" type="objId" index="y"/>
- <configElement name="name" type="string" index="y"/>
+ <configElement name="name" type="sstr" index="y"/>
- <instElement name="flowMode" type="enum(credit,window)"/>
- <instElement name="maxMsgCredits" type="uint32"/>
- <instElement name="maxByteCredits" type="uint32"/>
+ <instElement name="flowMode" type="uint8"/>
+ <instElement name="maxMsgCredits" type="uint32"/>
+ <instElement name="maxByteCredits" type="uint32"/>
+ <instElement name="msgCredits" type="uint32"/>
+ <instElement name="byteCredits" type="uint32"/>
- <instElement name="msgCredits" type="uint32"/>
- <instElement name="byteCredits" type="uint32"/>
-
<method name="throttle" desc="Apply extra rate limiting to destination: 0 = Normal, 10 = Maximum">
- <arg name="strength" type="uint8" min="0" max="10"/>
+ <arg name="strength" type="uint8" dir="I" min="0" max="10"/>
</method>
<method name="stop"/>
<method name="start"/>
- </object>
+ </class>
<!--
===============================================================
Producer
===============================================================
-->
- <object name="producer" schemaId="10">
+ <class name="producer" schemaId="10">
<configElement name="destinationRef" type="objId" index="y"/>
<configElement name="exchangeRef" type="objId" index="y"/>
- <instElement name="msgsProduced" type="uint64"/>
- <instElement name="bytesProduced" type="uint64"/>
- </object>
+ <instElement name="msgsProduced" type="count64"/>
+ <instElement name="bytesProduced" type="count64"/>
+ </class>
<!--
===============================================================
Consumer
===============================================================
-->
- <object name="consumer" schemaId="11">
+ <class name="consumer" schemaId="11">
<configElement name="destinationRef" type="objId" index="y"/>
<configElement name="queueRef" type="objId" index="y"/>
- <instElement name="msgsConsumed" type="uint64"/>
- <instElement name="bytesConsumed" type="uint64"/>
- <instElement name="unackedMessages" type="uint32_wm" desc="Messages consumed but not yet acked"/>
+ <instElement name="msgsConsumed" type="count64"/>
+ <instElement name="bytesConsumed" type="count64"/>
+ <instElement name="unackedMessages" type="hilo32" desc="Messages consumed but not yet acked"/>
<method name="close"/>
- </object>
+ </class>
</schema>
Added: mgmt/mint/xml/MgmtTypes.xml
===================================================================
--- mgmt/mint/xml/MgmtTypes.xml (rev 0)
+++ mgmt/mint/xml/MgmtTypes.xml 2007-11-08 22:03:47 UTC (rev 1277)
@@ -0,0 +1,41 @@
+<schema-types>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<type name="objId" base="u64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct"/>
+<type name="uint8" base="u8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="direct"/>
+<type name="uint16" base="u16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="direct"/>
+<type name="uint32" base="u32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="direct"/>
+<type name="uint64" base="u64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct"/>
+<type name="bool" base="u8" cpp="bool" encode="@.putOctet(#?1:0)" decode="# = @.getOctet()==1" accessor="direct"/>
+<type name="sstr" base="sstr" cpp="std::string" encode="@.putShortString(#)" decode="@.getShortString(#)" accessor="direct"/>
+<type name="lstr" base="lstr" cpp="std::string" encode="@.putLongString(#)" decode="@.getLongString(#)" accessor="direct"/>
+
+<type name="hilo8" base="u8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" style="wm" accessor="counter"/>
+<type name="hilo16" base="u16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" style="wm" accessor="counter"/>
+<type name="hilo32" base="u32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" style="wm" accessor="counter"/>
+<type name="hilo64" base="u64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="wm" accessor="counter"/>
+
+<type name="count8" base="u8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="counter"/>
+<type name="count16" base="u16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="counter"/>
+<type name="count32" base="u32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="counter"/>
+<type name="count64" base="u64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="counter"/>
+
+</schema-types>
17 years, 1 month
rhmessaging commits: r1276 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-08 16:46:00 -0500 (Thu, 08 Nov 2007)
New Revision: 1276
Modified:
mgmt/cumin/python/cumin/__init__.py
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/widgets.py
mgmt/notes/justin-todo.txt
Log:
Ajaxifies client status.
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2007-11-08 21:25:40 UTC (rev 1275)
+++ mgmt/cumin/python/cumin/__init__.py 2007-11-08 21:46:00 UTC (rev 1276)
@@ -12,7 +12,7 @@
from page import CuminPage
from queue import QueueXmlPage, QueueChartPage
from exchange import ExchangeXmlPage, ExchangeChartPage
-from client import ClientChartPage
+from client import ClientXmlPage, ClientChartPage
class Cumin(Application):
def __init__(self, model):
@@ -38,6 +38,7 @@
self.add_page(QueueChartPage(self, "queue.png"))
self.add_page(ExchangeXmlPage(self, "exchange.xml"))
self.add_page(ExchangeChartPage(self, "exchange.png"))
+ self.add_page(ClientXmlPage(self, "client.xml"))
self.add_page(ClientChartPage(self, "client.png"))
class CuminServer(WebServer):
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-11-08 21:25:40 UTC (rev 1275)
+++ mgmt/cumin/python/cumin/client.py 2007-11-08 21:46:00 UTC (rev 1276)
@@ -67,6 +67,9 @@
return "Client %s" % client.address
class ClientStatus(CuminStatus):
+ def render_data_url(self, session, client):
+ return "client.xml?id=%i" % client.id
+
def render_messages_produced(self, session, client):
value = client.get_measurement("msgsProduced").get_rate()
return fmt_rate(value, "msg", "sec")
@@ -171,6 +174,14 @@
def render_item_status(self, session, session_):
return fmt_status(len(session_.errors), len(session_.warnings))
+class ClientXmlPage(CuminXmlPage):
+ def __init__(self, app, name):
+ super(ClientXmlPage, self).__init__(app, name)
+
+ self.client = ClientParameter(app, "id")
+ self.add_parameter(self.client)
+ self.set_object_parameter(self.client)
+
class ClientChartPage(CuminChartPage):
def __init__(self, app, name):
super(ClientChartPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2007-11-08 21:25:40 UTC (rev 1275)
+++ mgmt/cumin/python/cumin/client.strings 2007-11-08 21:46:00 UTC (rev 1276)
@@ -32,6 +32,30 @@
<td>{item_status}</td>
</tr>
+[ClientStatus.javascript]
+function updateClientStatus(id, data) {
+ updateStatus(id, data);
+
+ var ms = data.root().elem("measurements");
+
+ var mprod = ms.elem("msgsproduced").elem("r").text().get();
+ var bprod = ms.elem("bytesproduced").elem("r").text().get();
+ var mcons = ms.elem("msgsconsumed").elem("r").text().get();
+ var bcons = ms.elem("bytesconsumed").elem("r").text().get();
+
+ var status = wooly.doc().elembyid(id);
+ var trs = status.elem("table").elem("tbody").elems("tr", 1);
+ var tds = null;
+
+ tds = trs.next().elems("td");
+ tds.next().text().set(mprod);
+ tds.next().text().set(bprod);
+
+ tds = trs.next().elems("td");
+ tds.next().text().set(mcons);
+ tds.next().text().set(bcons);
+}
+
[ClientStatus.html]
<div id="{id}" class="{class}">
<h2>Client Status</h2>
@@ -56,6 +80,9 @@
</tr>
</table>
</div>
+<script>
+ wooly.setIntervalUpdate("{id}", "{data_url}", updateClientStatus, 3000);
+</script>
[ClientView.html]
{status}
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-08 21:25:40 UTC (rev 1275)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-08 21:46:00 UTC (rev 1276)
@@ -386,24 +386,14 @@
value = producer.get_measurement("bytesProduced").get_rate()
return fmt_rate(value, "byte", "sec")
-class ExchangeXmlPage(Page):
+class ExchangeXmlPage(CuminXmlPage):
def __init__(self, app, name):
super(ExchangeXmlPage, self).__init__(app, name)
self.exchange = ExchangeParameter(app, "id")
self.add_parameter(self.exchange)
+ self.set_object_parameter(self.exchange)
- def get_content_type(self, session):
- return Page.xml_content_type
-
- def do_render(self, session, object):
- writer = Writer()
-
- writer.write(Page.xml_1_0_declaration)
- self.exchange.get(session).write_xml(writer)
-
- return writer.to_string()
-
class ExchangeChartPage(CuminChartPage):
def __init__(self, app, name):
super(ExchangeChartPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-08 21:25:40 UTC (rev 1275)
+++ mgmt/cumin/python/cumin/model.py 2007-11-08 21:46:00 UTC (rev 1276)
@@ -780,6 +780,15 @@
measure.categories = ("byte", "general")
self.measurements.append(measure)
+ def write_xml(self, writer):
+ writer.write("<client id=\"client-%i\">" % self.id)
+ writer.write("<address>%s</address>" % self.address)
+
+ self.write_error_xml(writer)
+ self.write_measurement_xml(writer)
+
+ writer.write("</client>")
+
class Session(CuminModelObject):
def __init__(self, model):
super(Session, self).__init__(model, model.session)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-08 21:25:40 UTC (rev 1275)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-08 21:46:00 UTC (rev 1276)
@@ -471,24 +471,14 @@
def render_item_unacked_messages(self, session, consumer):
return consumer.get_measurement("unackedMessages").get_value()
-class QueueXmlPage(Page):
+class QueueXmlPage(CuminXmlPage):
def __init__(self, app, name):
super(QueueXmlPage, self).__init__(app, name)
self.queue = QueueParameter(app, "id")
self.add_parameter(self.queue)
-
- def get_content_type(self, session):
- return Page.xml_content_type
+ self.set_object_parameter(self.queue)
- def do_render(self, session, object):
- writer = Writer()
-
- writer.write(Page.xml_1_0_declaration)
- self.queue.get(session).write_xml(writer)
-
- return writer.to_string()
-
class QueueChartPage(CuminChartPage):
def __init__(self, app, name):
super(QueueChartPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-11-08 21:25:40 UTC (rev 1275)
+++ mgmt/cumin/python/cumin/widgets.py 2007-11-08 21:46:00 UTC (rev 1276)
@@ -172,6 +172,30 @@
chart.write(writer)
return writer.to_string()
+class CuminXmlPage(Page):
+ def __init__(self, app, name):
+ super(CuminXmlPage, self).__init__(app, name)
+
+ self.__param = None
+
+ def set_object_parameter(self, param):
+ self.__param = param
+
+ def get_object(self, session, object):
+ return self.__param.get(session)
+
+ def get_content_type(self, session):
+ return Page.xml_content_type
+
+ def do_render(self, session, object):
+ writer = Writer()
+
+ writer.write(Page.xml_1_0_declaration)
+
+ object.write_xml(writer)
+
+ return writer.to_string()
+
class UnitSwitch(Widget):
def __init__(self, app, name):
super(UnitSwitch, self).__init__(app, name)
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-11-08 21:25:40 UTC (rev 1275)
+++ mgmt/notes/justin-todo.txt 2007-11-08 21:46:00 UTC (rev 1276)
@@ -8,8 +8,6 @@
* Exchange: ajaxify charts
- * Client: ajaxify status
-
* Client: ajaxify charts
* Queue: ajaxify charts
17 years, 1 month
rhmessaging commits: r1275 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-08 16:25:40 -0500 (Thu, 08 Nov 2007)
New Revision: 1275
Modified:
mgmt/cumin/python/cumin/exchange.strings
mgmt/notes/justin-todo.txt
Log:
Ajaxifies exchange status.
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-11-08 21:15:48 UTC (rev 1274)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-11-08 21:25:40 UTC (rev 1275)
@@ -87,7 +87,31 @@
function updateExchangeStatus(id, data) {
updateStatus(id, data);
+ var ms = data.root().elem("measurements");
+
+ var mrecv = ms.elem("msgreceives").elem("r").text().get();
+ var brecv = ms.elem("bytereceives").elem("r").text().get();
+ var mrt = ms.elem("msgroutes").elem("r").text().get();
+ var brt = ms.elem("byteroutes").elem("r").text().get();
+ var mdrp = ms.elem("msgdrops").elem("v").text().get();
+ var bdrp = ms.elem("bytedrops").elem("v").text().get();
+
var status = wooly.doc().elembyid(id);
+
+ var trs = status.elem("table").elem("tbody").elems("tr", 1);
+ var tds = null;
+
+ tds = trs.next().elems("td");
+ tds.next().text().set(mrecv);
+ tds.next().text().set(brecv);
+
+ tds = trs.next().elems("td");
+ tds.next().text().set(mrt);
+ tds.next().text().set(brt);
+
+ tds = trs.next().elems("td");
+ tds.next().text().set(mdrp);
+ tds.next().text().set(bdrp);
}
[ExchangeStatus.html]
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-11-08 21:15:48 UTC (rev 1274)
+++ mgmt/notes/justin-todo.txt 2007-11-08 21:25:40 UTC (rev 1275)
@@ -6,15 +6,13 @@
* Pagination and sort in tables
- * Exchange: ajaxify status
-
* Exchange: ajaxify charts
* Client: ajaxify status
- * Client: ajaxify status
+ * Client: ajaxify charts
- * Queue: ajaxify status
+ * Queue: ajaxify charts
Deferred
17 years, 1 month
rhmessaging commits: r1274 - in mgmt/cumin: resources and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-08 16:15:48 -0500 (Thu, 08 Nov 2007)
New Revision: 1274
Modified:
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/resources/wooly.js
Log:
Changes the signature for interval update callbacks. Adds a doc.root
method.
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-08 21:15:48 UTC (rev 1274)
@@ -116,7 +116,7 @@
return "Exchange '%s'" % exchange.name
class ExchangeStatus(CuminStatus):
- def render_xml_url(self, session, exchange):
+ def render_data_url(self, session, exchange):
return "exchange.xml?id=%i" % exchange.id
def render_messages_received(self, session, exchange):
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-11-08 21:15:48 UTC (rev 1274)
@@ -84,8 +84,10 @@
</script>
[ExchangeStatus.javascript]
-function updateExchangeStatus(xml, elem) {
- updateStatus(xml, elem);
+function updateExchangeStatus(id, data) {
+ updateStatus(id, data);
+
+ var status = wooly.doc().elembyid(id);
}
[ExchangeStatus.html]
@@ -118,7 +120,7 @@
</table>
</div>
<script>
- wooly.setIntervalUpdate("{id}", "{xml_url}", updateExchangeStatus, 3000);
+ wooly.setIntervalUpdate("{id}", "{data_url}", updateExchangeStatus, 3000);
</script>
[ExchangeView.html]
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/page.strings 2007-11-08 21:15:48 UTC (rev 1274)
@@ -547,22 +547,24 @@
}
[CuminPage.javascript]
-function updateStatus(xml, elem) {
- var ecount = xml.elem("error-count").text().get();
+function updateStatus(id, data) {
+ var ecount = data.elem("error-count").text().get();
var errors = ecount + " " + (ecount == "1" && "error" || "errors");
- var wcount = xml.elem("warning-count").text().get();
+ var wcount = data.elem("warning-count").text().get();
var warnings = wcount + " " + (wcount == "1" && "warning" || "warnings");
+ var status = wooly.doc().elembyid(id);
+
if (ecount != "0") {
- elem.node.className = "mstatus red";
+ status.node.className = "mstatus red";
} else if (wcount != "0") {
- elem.node.className = "mstatus yellow";
+ status.node.className = "mstatus yellow";
} else {
- elem.node.className = "mstatus green";
+ status.node.className = "mstatus green";
}
- elem.elem("div").set(errors + ", " + warnings);
+ status.elem("div").set(errors + ", " + warnings);
}
[CuminPage.html]
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-08 21:15:48 UTC (rev 1274)
@@ -108,7 +108,7 @@
return "Queue '%s'" % queue.name
class QueueStatus(CuminStatus):
- def render_url(self, session, queue):
+ def render_data_url(self, session, queue):
return "queue.xml?id=%i" % queue.id
def render_consumers(self, session, queue):
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-08 21:15:48 UTC (rev 1274)
@@ -89,10 +89,10 @@
</script>
[QueueStatus.javascript]
-function updateQueueStatus(xml, elem) {
- updateStatus(xml, elem);
+function updateQueueStatus(id, data) {
+ updateStatus(id, data);
- var ms = xml.elems("measurements").next();
+ var ms = data.root().elem("measurements");
var menq = ms.elem("msgtotalenqueues").elem("r").text().get();
var mdeq = ms.elem("msgtotaldequeues").elem("r").text().get();
@@ -103,7 +103,8 @@
var mdepacc = ms.elem("msgdepth").elem("r").text().get();
var bdepacc = ms.elem("bytedepth").elem("r").text().get();
- var trs = elem.elem("table").elem("tbody").elems("tr", 1);
+ var status = wooly.doc().elembyid(id);
+ var trs = status.elem("table").elem("tbody").elems("tr", 1);
var tds = null;
tds = trs.next().elems("td");
@@ -158,7 +159,7 @@
</table>
</div>
<script>
- wooly.setIntervalUpdate("{id}", "{url}", updateQueueStatus, 3000);
+ wooly.setIntervalUpdate("{id}", "{data_url}", updateQueueStatus, 3000);
</script>
[QueueView.html]
Modified: mgmt/cumin/resources/wooly.js
===================================================================
--- mgmt/cumin/resources/wooly.js 2007-11-08 20:46:05 UTC (rev 1273)
+++ mgmt/cumin/resources/wooly.js 2007-11-08 21:15:48 UTC (rev 1274)
@@ -50,9 +50,7 @@
if (req.readyState == 4 && req.status == 200) {
//dir(req);
- var elem = wooly.doc().elembyid(id);
-
- callback(wooly.doc(req.responseXML), elem);
+ callback(id, wooly.doc(req.responseXML));
}
} catch (e) {
log(e);
@@ -80,6 +78,10 @@
this.node = node;
+ this.root = function() {
+ return new WoolyElement(this, node.documentElement);
+ }
+
this.elembyid = function(id) {
var node = this.node.getElementById(id);
17 years, 1 month
rhmessaging commits: r1273 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-08 15:46:05 -0500 (Thu, 08 Nov 2007)
New Revision: 1273
Modified:
mgmt/cumin/python/cumin/__init__.py
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/queue.strings
Log:
Part 1 of 2 of ajaxification of exchange status. This part is mostly
model improvements to export measurements and errors/warnings in xml.
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2007-11-08 20:13:16 UTC (rev 1272)
+++ mgmt/cumin/python/cumin/__init__.py 2007-11-08 20:46:05 UTC (rev 1273)
@@ -11,7 +11,7 @@
from demo import DemoData
from page import CuminPage
from queue import QueueXmlPage, QueueChartPage
-from exchange import ExchangeChartPage
+from exchange import ExchangeXmlPage, ExchangeChartPage
from client import ClientChartPage
class Cumin(Application):
@@ -36,6 +36,7 @@
self.add_page(DevelPage(self, "devel.html"))
self.add_page(QueueXmlPage(self, "queue.xml"))
self.add_page(QueueChartPage(self, "queue.png"))
+ self.add_page(ExchangeXmlPage(self, "exchange.xml"))
self.add_page(ExchangeChartPage(self, "exchange.png"))
self.add_page(ClientChartPage(self, "client.png"))
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-11-08 20:13:16 UTC (rev 1272)
+++ mgmt/cumin/python/cumin/demo.py 2007-11-08 20:46:05 UTC (rev 1273)
@@ -174,7 +174,7 @@
def frob(self, mobject):
mobject.lock()
try:
- if isinstance(mobject, MeasuredModelObject):
+ if isinstance(mobject, CuminModelObject):
for measure in mobject.measurements:
self.frob_measure(measure)
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-08 20:13:16 UTC (rev 1272)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-08 20:46:05 UTC (rev 1273)
@@ -116,6 +116,9 @@
return "Exchange '%s'" % exchange.name
class ExchangeStatus(CuminStatus):
+ def render_xml_url(self, session, exchange):
+ return "exchange.xml?id=%i" % exchange.id
+
def render_messages_received(self, session, exchange):
value = exchange.get_measurement("msgReceives").get_rate()
return fmt_rate(value, "msg", "sec")
@@ -383,6 +386,24 @@
value = producer.get_measurement("bytesProduced").get_rate()
return fmt_rate(value, "byte", "sec")
+class ExchangeXmlPage(Page):
+ def __init__(self, app, name):
+ super(ExchangeXmlPage, self).__init__(app, name)
+
+ self.exchange = ExchangeParameter(app, "id")
+ self.add_parameter(self.exchange)
+
+ def get_content_type(self, session):
+ return Page.xml_content_type
+
+ def do_render(self, session, object):
+ writer = Writer()
+
+ writer.write(Page.xml_1_0_declaration)
+ self.exchange.get(session).write_xml(writer)
+
+ return writer.to_string()
+
class ExchangeChartPage(CuminChartPage):
def __init__(self, app, name):
super(ExchangeChartPage, self).__init__(app, name)
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-11-08 20:13:16 UTC (rev 1272)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-11-08 20:46:05 UTC (rev 1273)
@@ -83,6 +83,11 @@
}())
</script>
+[ExchangeStatus.javascript]
+function updateExchangeStatus(xml, elem) {
+ updateStatus(xml, elem);
+}
+
[ExchangeStatus.html]
<div id="{id}" class="{class}">
<h2>Exchange Status</h2>
@@ -112,6 +117,9 @@
</tr>
</table>
</div>
+<script>
+ wooly.setIntervalUpdate("{id}", "{xml_url}", updateExchangeStatus, 3000);
+</script>
[ExchangeView.html]
{status}
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-08 20:13:16 UTC (rev 1272)
+++ mgmt/cumin/python/cumin/model.py 2007-11-08 20:46:05 UTC (rev 1273)
@@ -175,10 +175,12 @@
def get_realm(self, id):
return self.get_index(self.realm).get(id)
-class MeasuredModelObject(ModelObject):
+class CuminModelObject(ModelObject):
def __init__(self, model, mclass):
- super(MeasuredModelObject, self).__init__(model, mclass)
+ super(CuminModelObject, self).__init__(model, mclass)
+ self.errors = list()
+ self.warnings = list()
self.measurements = list()
def get_measurement(self, name):
@@ -186,45 +188,50 @@
if measure.name == name:
return measure
-class BrokerCluster(ModelObject):
+ def write_error_xml(self, writer):
+ writer.write("<error-count>%i</error-count>" % len(self.errors))
+ writer.write("<warning-count>%i</warning-count>" % len(self.warnings))
+
+ def write_measurement_xml(self, writer):
+ writer.write("<measurements>")
+
+ for measure in self.measurements:
+ measure.write_xml(writer)
+
+ writer.write("</measurements>")
+
+class BrokerCluster(CuminModelObject):
def __init__(self, model):
super(BrokerCluster, self).__init__(model, model.broker_cluster)
self.name = None
- self.errors = list()
- self.warnings = list()
-
-class Broker(ModelObject):
+class Broker(CuminModelObject):
def __init__(self, model):
super(Broker, self).__init__(model, model.broker)
self.name = None
self.default_virtual_host = None
- self.errors = list()
- self.warnings = list()
-
def write_xml(self, writer):
writer.write("<broker id=\"broker-%i\">" % self.id)
writer.write("<name>" + self.name + "</name>")
writer.write("<default-virtual-host ref=\"virtual-host-%i\"/>" \
% self.default_virtual_host.id)
+ self.write_error_xml(writer)
+
for vhost in self.virtual_host_items():
vhost.write_xml(writer)
writer.write("</broker>")
-class BrokerProfile(ModelObject):
+class BrokerProfile(CuminModelObject):
def __init__(self, model):
super(BrokerProfile, self).__init__(model, model.broker_profile)
self.name = None
- self.errors = list()
- self.warnings = list()
-
class ConfigProperty(ModelObject):
def __init__(self, model):
super(ConfigProperty, self).__init__(model, model.config_property)
@@ -234,22 +241,19 @@
self.broker_value = None
self.type = None # ("boolean", "integer", "string")
-class BrokerGroup(ModelObject):
+class BrokerGroup(CuminModelObject):
def __init__(self, model):
super(BrokerGroup, self).__init__(model, model.broker_group)
self.name = None
- self.errors = list()
- self.warnings = list()
-
class BrokerGroupType(ModelObject):
def __init__(self, model):
super(BrokerGroupType, self).__init__(model, model.broker_group_type)
self.name = None
-class VirtualHost(ModelObject):
+class VirtualHost(CuminModelObject):
def __init__(self, model):
super(VirtualHost, self).__init__(model, model.virtual_host)
@@ -278,6 +282,8 @@
writer.write("<default-exchange ref=\"exchange-%i\"/>" \
% self.default_exchange.id)
+ self.write_error_xml(writer)
+
for queue in self.queue_items():
queue.write_xml(writer)
@@ -295,20 +301,18 @@
self.name = None
-class Realm(ModelObject):
+class Realm(CuminModelObject):
def __init__(self, model):
- model.lock()
-
super(Realm, self).__init__(model, model.realm)
self.name = None
- model.unlock()
-
def write_xml(self, writer):
writer.write("<realm id=\"realm-%i\">" % self.id)
writer.write("<name>%s</name>" % self.name)
+ self.write_error_xml(writer)
+
for queue in self.queue_items():
writer.write("<queue ref=\"queue-%i\"/>" % queue.id)
@@ -386,7 +390,7 @@
writer.write("<%s><v>%i</v><r>%i</r></%s>" % \
(self.name, self.get_value(), self.get_rate(), self.name))
-class Queue(MeasuredModelObject):
+class Queue(CuminModelObject):
def __init__(self, model):
super(Queue, self).__init__(model, model.queue)
@@ -397,9 +401,6 @@
self.is_auto_delete = False
self.latency_priority = "m" # h, m, or l
- self.errors = list()
- self.warnings = list()
-
# General
measure = Measurement("consumers", "int")
@@ -594,25 +595,20 @@
writer.write("<name>%s</name>" % self.name)
writer.write("<latency-priority>%s</latency-priority>" \
% self.latency_priority)
- writer.write("<error-count>%i</error-count>" % len(self.errors))
- writer.write("<warning-count>%i</warning-count>" % len(self.warnings))
+ self.write_error_xml(writer)
+
for realm in self.realm_items():
writer.write("<realm ref=\"realm-%i\"/>" % realm.id)
for binding in self.binding_items():
binding.write_xml(writer)
- writer.write("<measurements>")
-
- for measure in self.measurements:
- measure.write_xml(writer)
-
- writer.write("</measurements>")
+ self.write_measurement_xml(writer)
writer.write("</queue>")
-class Consumer(MeasuredModelObject):
+class Consumer(CuminModelObject):
def __init__(self, model):
super(Consumer, self).__init__(model, model.consumer)
@@ -637,7 +633,7 @@
measure.highlow = True
self.measurements.append(measure)
-class Exchange(MeasuredModelObject):
+class Exchange(CuminModelObject):
def __init__(self, model):
super(Exchange, self).__init__(model, model.exchange)
@@ -648,9 +644,6 @@
self.is_auto_delete = False
self.is_internal = False
- self.errors = list()
- self.warnings = list()
-
measure = Measurement("producers", "int")
measure.title = "Producers"
measure.unit = "producer"
@@ -710,18 +703,20 @@
def write_xml(self, writer):
writer.write("<exchange id=\"exchange-%i\">" % self.id)
writer.write("<name>%s</name>" % self.name)
- #writer.write("<error-count>%i</error-count>" % self.error_count)
- #writer.write("<warning-count>%i</warning-count>" % self.warning_count)
+ self.write_error_xml(writer)
+
for realm in self.realm_items():
writer.write("<realm ref=\"realm-%i\"/>" % realm.id)
for binding in self.binding_items():
binding.write_xml(writer)
+
+ self.write_measurement_xml(writer)
writer.write("</exchange>")
-class Producer(MeasuredModelObject):
+class Producer(CuminModelObject):
def __init__(self, model):
super(Producer, self).__init__(model, model.producer)
@@ -737,7 +732,7 @@
measure.categories = ("byte", "general")
self.measurements.append(measure)
-class Binding(MeasuredModelObject):
+class Binding(CuminModelObject):
def __init__(self, model):
super(Binding, self).__init__(model, model.binding)
@@ -753,17 +748,18 @@
writer.write("<exchange ref=\"exchange-%i\"/>" % self.exchange.id)
writer.write("<queue ref=\"queue-%i\"/>" % self.queue.id)
writer.write("<binding-key>%s</binding-key>" % self.binding_key)
+
+ self.write_error_xml(writer)
+ self.write_measurement_xml(writer)
+
writer.write("</binding>")
-class Client(MeasuredModelObject):
+class Client(CuminModelObject):
def __init__(self, model):
super(Client, self).__init__(model, model.client)
self.address = None
- self.errors = list()
- self.warnings = list()
-
measure = Measurement("msgsProduced", "int")
measure.title = "Msgs. Produced"
measure.categories = ("message", "general")
@@ -784,15 +780,12 @@
measure.categories = ("byte", "general")
self.measurements.append(measure)
-class Session(MeasuredModelObject):
+class Session(CuminModelObject):
def __init__(self, model):
super(Session, self).__init__(model, model.session)
self.name = None
- self.errors = list()
- self.warnings = list()
-
measure = Measurement("attached", "bool")
measure.title = "Attached"
measure.categories = ("general")
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-11-08 20:13:16 UTC (rev 1272)
+++ mgmt/cumin/python/cumin/page.strings 2007-11-08 20:46:05 UTC (rev 1273)
@@ -546,6 +546,25 @@
color: #999;
}
+[CuminPage.javascript]
+function updateStatus(xml, elem) {
+ var ecount = xml.elem("error-count").text().get();
+ var errors = ecount + " " + (ecount == "1" && "error" || "errors");
+
+ var wcount = xml.elem("warning-count").text().get();
+ var warnings = wcount + " " + (wcount == "1" && "warning" || "warnings");
+
+ if (ecount != "0") {
+ elem.node.className = "mstatus red";
+ } else if (wcount != "0") {
+ elem.node.className = "mstatus yellow";
+ } else {
+ elem.node.className = "mstatus green";
+ }
+
+ elem.elem("div").set(errors + ", " + warnings);
+}
+
[CuminPage.html]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-08 20:13:16 UTC (rev 1272)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-08 20:46:05 UTC (rev 1273)
@@ -90,22 +90,8 @@
[QueueStatus.javascript]
function updateQueueStatus(xml, elem) {
- var ecount = xml.elem("error-count").text().get();
- var errors = ecount + " " + (ecount == "1" && "error" || "errors");
+ updateStatus(xml, elem);
- var wcount = xml.elem("warning-count").text().get();
- var warnings = wcount + " " + (wcount == "1" && "warning" || "warnings");
-
- if (ecount != "0") {
- elem.node.className = "mstatus red";
- } else if (wcount != "0") {
- elem.node.className = "mstatus yellow";
- } else {
- elem.node.className = "mstatus green";
- }
-
- elem.elem("div").set(errors + ", " + warnings);
-
var ms = xml.elems("measurements").next();
var menq = ms.elem("msgtotalenqueues").elem("r").text().get();
17 years, 1 month
rhmessaging commits: r1272 - in mgmt/cumin: resources and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-08 15:13:16 -0500 (Thu, 08 Nov 2007)
New Revision: 1272
Modified:
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/resources/wooly.js
Log:
More javascript code improvements. doc.elem is retasked for getting
the first elem of a certain name, and its old meaning is found under
doc.elembyid.
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-08 19:25:17 UTC (rev 1271)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-08 20:13:16 UTC (rev 1272)
@@ -90,10 +90,10 @@
[QueueStatus.javascript]
function updateQueueStatus(xml, elem) {
- var ecount = xml.elems("error-count").next().text().get();
+ var ecount = xml.elem("error-count").text().get();
var errors = ecount + " " + (ecount == "1" && "error" || "errors");
- var wcount = xml.elems("warning-count").next().text().get();
+ var wcount = xml.elem("warning-count").text().get();
var warnings = wcount + " " + (wcount == "1" && "warning" || "warnings");
if (ecount != "0") {
@@ -104,8 +104,7 @@
elem.node.className = "mstatus green";
}
- var divs = elem.elems("div");
- divs.next().set(errors + ", " + warnings);
+ elem.elem("div").set(errors + ", " + warnings);
var ms = xml.elems("measurements").next();
Modified: mgmt/cumin/resources/wooly.js
===================================================================
--- mgmt/cumin/resources/wooly.js 2007-11-08 19:25:17 UTC (rev 1271)
+++ mgmt/cumin/resources/wooly.js 2007-11-08 20:13:16 UTC (rev 1272)
@@ -50,7 +50,7 @@
if (req.readyState == 4 && req.status == 200) {
//dir(req);
- var elem = wooly.doc().elem(id);
+ var elem = wooly.doc().elembyid(id);
callback(wooly.doc(req.responseXML), elem);
}
@@ -80,7 +80,7 @@
this.node = node;
- this.elem = function(id) {
+ this.elembyid = function(id) {
var node = this.node.getElementById(id);
if (node) {
@@ -88,12 +88,24 @@
}
}
- this.elems = function(tag) {
- var nodes = this.node.getElementsByTagName(tag);
-
- return new WoolyIterator(this, WoolyElement,
- nodes, 1, tag);
+ this.elems = function(name, start) {
+ if (start == null) {
+ start = 0;
+ }
+
+ var nodes = this.node.getElementsByTagName(name);
+ var iter = new WoolyIterator(this, WoolyElement, nodes, 1, name);
+
+ for (var i = 0; i < start; i++) {
+ iter.next();
+ }
+
+ return iter;
}
+
+ this.elem = function(name, n) {
+ return this.elems(name, n).next();
+ }
}
function WoolyIterator(doc, nodeClass, nodes, nodeType, nodeName) {
@@ -191,18 +203,7 @@
}
this.elem = function(name, n) {
- if (n == null) {
- n = 0;
- }
-
- var elems = this.elems(name);
- var elem = null;
-
- for (var i = -1; i < n; i++) {
- elem = elems.next();
- }
-
- return elem;
+ return this.elems(name, n).next();
}
this.text = function() {
17 years, 1 month
rhmessaging commits: r1271 - in mgmt: cumin/python/wooly and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-08 14:25:17 -0500 (Thu, 08 Nov 2007)
New Revision: 1271
Modified:
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/resources/wooly.js
mgmt/notes/justin-todo.txt
Log:
Re-implements ajax updates for the new queue status box. Improves the
javascript convenience api.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-08 18:48:57 UTC (rev 1270)
+++ mgmt/cumin/python/cumin/model.py 2007-11-08 19:25:17 UTC (rev 1271)
@@ -382,6 +382,10 @@
def get_low(self):
return self.__low
+ def write_xml(self, writer):
+ writer.write("<%s><v>%i</v><r>%i</r></%s>" % \
+ (self.name, self.get_value(), self.get_rate(), self.name))
+
class Queue(MeasuredModelObject):
def __init__(self, model):
super(Queue, self).__init__(model, model.queue)
@@ -598,6 +602,13 @@
for binding in self.binding_items():
binding.write_xml(writer)
+
+ writer.write("<measurements>")
+
+ for measure in self.measurements:
+ measure.write_xml(writer)
+
+ writer.write("</measurements>")
writer.write("</queue>")
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-11-08 18:48:57 UTC (rev 1270)
+++ mgmt/cumin/python/cumin/queue.strings 2007-11-08 19:25:17 UTC (rev 1271)
@@ -88,34 +88,57 @@
}())
</script>
-[QueueStatus.html]
-<script defer="defer">
-(function() {
- var updateStatus = function(xml, elem) {
- var ecount = xml.elems("error-count").next().text().get();
- var errors = ecount + " " + (ecount == "1" && "error" || "errors");
+[QueueStatus.javascript]
+function updateQueueStatus(xml, elem) {
+ var ecount = xml.elems("error-count").next().text().get();
+ var errors = ecount + " " + (ecount == "1" && "error" || "errors");
- var wcount = xml.elems("warning-count").next().text().get();
- var warnings = wcount + " " + (wcount == "1" && "warning" || "warnings");
+ var wcount = xml.elems("warning-count").next().text().get();
+ var warnings = wcount + " " + (wcount == "1" && "warning" || "warnings");
- if (ecount != "0") {
- elem.node.className = "mstatus red";
- } else if (wcount != "0") {
- elem.node.className = "mstatus yellow";
- } else {
- elem.node.className = "mstatus green";
- }
+ if (ecount != "0") {
+ elem.node.className = "mstatus red";
+ } else if (wcount != "0") {
+ elem.node.className = "mstatus yellow";
+ } else {
+ elem.node.className = "mstatus green";
+ }
- var divs = elem.elems("div");
- divs.next().set(errors + ", " + warnings);
+ var divs = elem.elems("div");
+ divs.next().set(errors + ", " + warnings);
- // XXX
- //wooly.doc().elem("{id}.menq").text().set("hmm")
- }
+ var ms = xml.elems("measurements").next();
- wooly.setIntervalUpdate("{id}", "{url}", updateStatus, 3000);
-}())
-</script>
+ var menq = ms.elem("msgtotalenqueues").elem("r").text().get();
+ var mdeq = ms.elem("msgtotaldequeues").elem("r").text().get();
+ var benq = ms.elem("bytetotalenqueues").elem("r").text().get();
+ var bdeq = ms.elem("bytetotaldequeues").elem("r").text().get();
+ var mdep = ms.elem("msgdepth").elem("v").text().get();
+ var bdep = ms.elem("bytedepth").elem("v").text().get();
+ var mdepacc = ms.elem("msgdepth").elem("r").text().get();
+ var bdepacc = ms.elem("bytedepth").elem("r").text().get();
+
+ var trs = elem.elem("table").elem("tbody").elems("tr", 1);
+ var tds = null;
+
+ tds = trs.next().elems("td");
+ tds.next().text().set(menq);
+ tds.next().text().set(mdeq);
+
+ tds = trs.next().elems("td");
+ tds.next().text().set(benq);
+ tds.next().text().set(bdeq);
+
+ tds = trs.next().elems("td");
+ tds.next().set(mdep);
+ tds.next().set(bdep);
+
+ tds = trs.next().elems("td");
+ tds.next().text().set(mdepacc);
+ tds.next().text().set(bdepacc);
+}
+
+[QueueStatus.html]
<div id="{id}" class="{class}">
<h2>Queue Status</h2>
@@ -129,26 +152,29 @@
</tr>
<tr>
<th>Enqueued</th>
- <td id="{id}.menq" class="ralign">{messages_enqueued}</td>
- <td id="{id}.benq" class="ralign">{bytes_enqueued}</td>
+ <td class="ralign">{messages_enqueued}</td>
+ <td class="ralign">{bytes_enqueued}</td>
</tr>
<tr>
<th>Dequeued</th>
- <td id="{id}.mdeq" class="ralign">{messages_dequeued}</td>
- <td id="{id}.bdeq" class="ralign">{bytes_dequeued}</td>
+ <td class="ralign">{messages_dequeued}</td>
+ <td class="ralign">{bytes_dequeued}</td>
</tr>
<tr>
<th>Depth</th>
- <td id="{id}.mdep" class="ralign">{message_depth}</td>
- <td id="{id}.bdep" class="ralign">{byte_depth}</td>
+ <td class="ralign">{message_depth}</td>
+ <td class="ralign">{byte_depth}</td>
</tr>
<tr>
<th>Accel.</th>
- <td id="{id}.mdepaccel" class="ralign">{message_depth_accel}</td>
- <td id="{id}.bdepaccel" class="ralign">{byte_depth_accel}</td>
+ <td class="ralign">{message_depth_accel}</td>
+ <td class="ralign">{byte_depth_accel}</td>
</tr>
</table>
</div>
+<script>
+ wooly.setIntervalUpdate("{id}", "{url}", updateQueueStatus, 3000);
+</script>
[QueueView.html]
{status}
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-11-08 18:48:57 UTC (rev 1270)
+++ mgmt/cumin/python/wooly/__init__.py 2007-11-08 19:25:17 UTC (rev 1271)
@@ -468,6 +468,7 @@
def clear_caches(self):
self.cached_css = None
+ self.cached_javascript = None
class Session(object):
def __init__(self, app, trunk=None):
Modified: mgmt/cumin/resources/wooly.js
===================================================================
--- mgmt/cumin/resources/wooly.js 2007-11-08 18:48:57 UTC (rev 1270)
+++ mgmt/cumin/resources/wooly.js 2007-11-08 19:25:17 UTC (rev 1271)
@@ -174,12 +174,37 @@
return this;
}
- this.elems = function(name) {
- return new WoolyIterator(this.doc, WoolyElement,
- this.node.childNodes,
- 1, name);
+ this.elems = function(name, start) {
+ if (start == null) {
+ start = 0;
+ }
+
+ var iter = new WoolyIterator(this.doc, WoolyElement,
+ this.node.childNodes,
+ 1, name);
+
+ for (var i = 0; i < start; i++) {
+ iter.next();
+ }
+
+ return iter;
}
+ this.elem = function(name, n) {
+ if (n == null) {
+ n = 0;
+ }
+
+ var elems = this.elems(name);
+ var elem = null;
+
+ for (var i = -1; i < n; i++) {
+ elem = elems.next();
+ }
+
+ return elem;
+ }
+
this.text = function() {
var children = this.node.childNodes;
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-11-08 18:48:57 UTC (rev 1270)
+++ mgmt/notes/justin-todo.txt 2007-11-08 19:25:17 UTC (rev 1271)
@@ -6,10 +6,16 @@
* Pagination and sort in tables
- * Ajaxify status boxes
+ * Exchange: ajaxify status
- * Ajaxify charts
+ * Exchange: ajaxify charts
+ * Client: ajaxify status
+
+ * Client: ajaxify status
+
+ * Queue: ajaxify status
+
Deferred
* Think about making css and jscript pages produce their document in
17 years, 1 month
rhmessaging commits: r1270 - in store/trunk/cpp: tests and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: cctrieloff
Date: 2007-11-08 13:48:57 -0500 (Thu, 08 Nov 2007)
New Revision: 1270
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/BdbMessageStore.h
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/tests/SimpleTest.cpp
Log:
- full support staging in async
- transient staging not optimized for AIO yet.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2007-11-08 15:25:15 UTC (rev 1269)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2007-11-08 18:48:57 UTC (rev 1270)
@@ -722,7 +722,7 @@
readXids(prepareXidDb, xids);
}
-void BdbMessageStore::stage(PersistableMessage& msg)
+void BdbMessageStore::stage( PersistableMessage& msg)
{
checkInit();
TxnCtxt txn;
@@ -804,13 +804,22 @@
THROW_STORE_EXCEPTION("Cannot append content. Message not known to store!");
}
}
-void BdbMessageStore::loadContent(const PersistableMessage& msg, std::string& data, u_int64_t offset, u_int32_t length)
+
+void BdbMessageStore::loadContent(const qpid::broker::PersistableQueue& queue,
+ const PersistableMessage& msg, std::string& data, u_int64_t offset, u_int32_t length)
{
checkInit();
u_int64_t realOffset = offset + sizeof(u_int32_t)/*header length*/+ msg.encodedHeaderSize();
u_int64_t messageId (msg.getPersistenceId());
+
if (messageId != 0) {
try {
+ JournalImpl* jc = static_cast<JournalImpl*>(queue.getExternalQueueStore());
+ if (jc && jc->is_enqueued(messageId) ){
+ if (jc->loadMsgContent(messageId, data, realOffset, length)){
+ return;
+ }
+ }
Dbt key (&messageId, sizeof(messageId));
char *buffer = new char[length];
Dbt value(buffer, length);
@@ -820,15 +829,17 @@
value.set_dlen(length);
int status = messageDb.get(0, &key, &value, 0);
if (status == DB_NOTFOUND) {
- delete [] buffer;
+ delete [] buffer;
THROW_STORE_EXCEPTION("Cannot load content. Message not known to store!");
} else {
data.assign(buffer, value.get_size());
- delete [] buffer;
+ delete [] buffer;
}
} catch (DbException& e) {
THROW_STORE_EXCEPTION_2("Error loading content", e);
- }
+ } catch (journal::jexception& e) {
+ THROW_STORE_EXCEPTION("Error loading content" /*, e*/);
+ }
} else {
THROW_STORE_EXCEPTION("Cannot load content. Message not known to store!");
}
Modified: store/trunk/cpp/lib/BdbMessageStore.h
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.h 2007-11-08 15:25:15 UTC (rev 1269)
+++ store/trunk/cpp/lib/BdbMessageStore.h 2007-11-08 18:48:57 UTC (rev 1270)
@@ -153,7 +153,8 @@
void stage(qpid::broker::PersistableMessage& msg);
void destroy(qpid::broker::PersistableMessage& msg);
void appendContent(const qpid::broker::PersistableMessage& msg, const std::string& data);
- void loadContent(const qpid::broker::PersistableMessage& msg, std::string& data, u_int64_t offset, u_int32_t length);
+ void loadContent(const qpid::broker::PersistableQueue& queue, const qpid::broker::PersistableMessage& msg,
+ std::string& data, u_int64_t offset, u_int32_t length);
void enqueue(qpid::broker::TransactionContext* ctxt,
qpid::broker::PersistableMessage& msg,
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2007-11-08 15:25:15 UTC (rev 1269)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2007-11-08 18:48:57 UTC (rev 1270)
@@ -153,14 +153,14 @@
}
}
if (_external)
- return true;
+ return false;
if (offset + length > _dlen) {
std::stringstream ss;
ss << "loadMsgContent(): offset + length exceeds available message size";
throw jexception(ss.str());
}
data.append((const char*)_datap + offset, length);
- return false;
+ return true;
}
const iores
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2007-11-08 15:25:15 UTC (rev 1269)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2007-11-08 18:48:57 UTC (rev 1270)
@@ -268,7 +268,8 @@
CPPUNIT_ASSERT_EQUAL((u_int64_t) 14, msg->contentSize());
DummyHandler handler;
- MessageDelivery::deliver(msg, handler, 0, MessageDelivery::getBasicConsumeToken("ignore"), 100);
+ QueuedMessage qm(queue.get(),msg,0);
+ MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getBasicConsumeToken("ignore"), 100);
CPPUNIT_ASSERT_EQUAL((size_t) 3, handler.frames.size());
AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[2].getBody()));
CPPUNIT_ASSERT(contentBody);
@@ -314,7 +315,7 @@
}
void testStagingSync() {testStaging(false);}
- void testStagingAsync() {std::cout << std::endl << "Missing Async test!!" << std::endl << std:: flush;}
+ void testStagingAsync() {testStaging(true);}
void testStaging(bool async)
{
const string name("MyDurableQueue");
@@ -354,7 +355,8 @@
//load it (without recovery)
DummyHandler handler;
- MessageDelivery::deliver(msg, handler, 0,
+ QueuedMessage qm(&queue, msg, 0);
+ MessageDelivery::deliver(qm, handler, 0,
MessageDelivery::getBasicConsumeToken("ignore"), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12
CPPUNIT_ASSERT(handler.frames.size() > 2);
string loaded;
@@ -394,7 +396,8 @@
//load lazily
DummyHandler handler;
- MessageDelivery::deliver(msg, handler, 0, MessageDelivery::getBasicConsumeToken("ignore"), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12
+ QueuedMessage qm(queue.get(),msg,0);
+ MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getBasicConsumeToken("ignore"), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12
CPPUNIT_ASSERT(handler.frames.size() > 2);
string loaded;
@@ -411,7 +414,7 @@
}
void testDestroyStagedMessageSync() {testDestroyStagedMessage(false);}
- void testDestroyStagedMessageAsync() {std::cout << std::endl << "Missing Async test!!" << std::endl << std:: flush;}
+ void testDestroyStagedMessageAsync() {testDestroyStagedMessage(true);}
void testDestroyStagedMessage(bool async)
{
BdbMessageStore store;
@@ -427,14 +430,15 @@
try {
string loaded;
- store.loadContent(*msg, loaded, 0, data.length());
+ Queue queue("dummy", 0, &store, 0);
+ store.loadContent(queue, *msg, loaded, 0, data.length());
CPPUNIT_ASSERT(false);
} catch (StoreException& e) {
}
}
void testDestroyEnqueuedMessageSync() {testDestroyEnqueuedMessage(false);}
- void testDestroyEnqueuedMessageAsync() {std::cout << std::endl << "Missing Async test!!" << std::endl << std:: flush;}
+ void testDestroyEnqueuedMessageAsync() {testDestroyEnqueuedMessage(true);}
void testDestroyEnqueuedMessage(bool async)
{
BdbMessageStore store;
@@ -452,7 +456,7 @@
store.destroy(*msg);
string loaded;
- store.loadContent(*msg, loaded, 0, data.length());
+ store.loadContent(queue, *msg, loaded, 0, data.length());
CPPUNIT_ASSERT_EQUAL(data, loaded);
store.dequeue(0, *msg, queue);
17 years, 1 month
rhmessaging commits: r1269 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-11-08 10:25:15 -0500 (Thu, 08 Nov 2007)
New Revision: 1269
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
Log:
Fixed memory leak associated with new JournalImpl::loadMsgContent() function
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2007-11-08 14:55:16 UTC (rev 1268)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2007-11-08 15:25:15 UTC (rev 1269)
@@ -43,6 +43,7 @@
getEventsTimerSetFlag(false),
writeActivityFlag(false),
flushTriggeredFlag(true),
+ _xidp(0),
_datap(0),
_dlen(0),
_dtok(),
@@ -58,6 +59,13 @@
{
(dynamic_cast<GetEventsFireEvent*>(getEventsFireEventsPtr.get()))->cancel();
(dynamic_cast<InactivityFireEvent*>(inactivityFireEventPtr.get()))->cancel();
+ if (_xidp) {
+ ::free(_xidp);
+ _xidp = 0;
+ } else if (_datap) {
+ ::free(_datap);
+ _datap = 0;
+ }
}
void
@@ -104,20 +112,27 @@
{
if (_dtok.rid() != rid)
{
- _datap = 0;
+ // Free any previous msg
+ if (_xidp) {
+ ::free(_xidp);
+ _xidp = 0;
+ } else if (_datap) {
+ ::free(_datap);
+ _datap = 0;
+ }
_dlen = 0;
_dtok.reset();
_dtok.set_rid(rid);
_dtok.set_wstate(journal::data_tok::ENQ);
_external = false;
- void* xidp = 0;
size_t xlen = 0;
bool transient = false;
bool done = false;
unsigned aio_sleep_cnt = 0;
while (!done)
{
- iores res = read_data_record(&_datap, _dlen, &xidp, xlen, transient, _external, &_dtok);
+ iores res = read_data_record(&_datap, _dlen, &_xidp, xlen, transient, _external,
+ &_dtok);
if (res == journal::RHM_IORES_SUCCESS) {
done = true;
} else if (res == journal::RHM_IORES_AIO_WAIT) {
@@ -136,12 +151,6 @@
throw jexception(ss.str());
}
}
- // set correct pointer for deletion by boost::shared_ptr
- if (xlen) {
- _master = boost::shared_ptr<char>((char*)xidp);
- } else {
- _master = boost::shared_ptr<char>((char*)_datap);
- }
}
if (_external)
return true;
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2007-11-08 14:55:16 UTC (rev 1268)
+++ store/trunk/cpp/lib/JournalImpl.h 2007-11-08 15:25:15 UTC (rev 1269)
@@ -75,7 +75,7 @@
qpid::broker::TimerTaskA::intrusive_ptr inactivityFireEventPtr;
// temp local vars for loadMsgContent below
- boost::shared_ptr<char> _master;
+ void* _xidp;
void* _datap;
size_t _dlen;
journal::data_tok _dtok;
17 years, 1 month
rhmessaging commits: r1268 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-11-08 09:55:16 -0500 (Thu, 08 Nov 2007)
New Revision: 1268
Modified:
store/trunk/cpp/lib/jrnl/enq_map.cpp
store/trunk/cpp/lib/jrnl/enq_map.hpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
Log:
Added a is_enqueued(rid) fn to jcntl.
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-11-08 14:06:24 UTC (rev 1267)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2007-11-08 14:55:16 UTC (rev 1268)
@@ -119,6 +119,19 @@
return fid;
}
+const bool
+enq_map::is_enqueued(const u_int64_t rid)
+{
+ pthread_mutex_lock(&_mutex);
+ emap_itr itr = _map.find(rid);
+ pthread_mutex_unlock(&_mutex);
+ if (itr == _map.end()) // not found in map
+ return false;
+ if (itr->second.second) // locked
+ return false;
+ return true;
+}
+
void
enq_map::lock(const u_int64_t rid) throw (jexception)
{
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-11-08 14:06:24 UTC (rev 1267)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2007-11-08 14:55:16 UTC (rev 1268)
@@ -77,6 +77,7 @@
const u_int16_t get_fid(const u_int64_t rid) throw (jexception);
const u_int16_t get_remove_fid(const u_int64_t rid, const bool txn_flag = false)
throw (jexception);
+ const bool is_enqueued(const u_int64_t rid);
void lock(const u_int64_t rid) throw (jexception);
void unlock(const u_int64_t rid) throw (jexception);
const bool is_locked(const u_int64_t rid) throw (jexception);
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-11-08 14:06:24 UTC (rev 1267)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-11-08 14:55:16 UTC (rev 1268)
@@ -555,6 +555,13 @@
{ return _rrfc.file_handle(pi)->rd_aio_outstanding_dblks(); }
/**
+ * \brief Check if a particular rid is enqueued. Note that this function will return
+ * false if the rid is transactionally enqueued and is not committed, or if it is
+ * locked (i.e. transactionally dequeued, but the dequeue has not been committed).
+ */
+ inline const bool is_enqueued(const u_int64_t rid) { return _emap.is_enqueued(rid); }
+
+ /**
* \brief Check if the journal is stopped.
*
* \return <b><i>true</i></b> if the jouranl is stopped;
17 years, 1 month