[jboss-svn-commits] JBL Code SVN: r14527 - in labs/jbossesb/trunk/product/tools/console: management/src/main/java/org/jboss/soa/esb/monitoring/server and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Aug 24 09:18:43 EDT 2007
Author: tcunning
Date: 2007-08-24 09:18:43 -0400 (Fri, 24 Aug 2007)
New Revision: 14527
Modified:
labs/jbossesb/trunk/product/tools/console/management-web/build.xml
labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/attribute.jsp
labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/index.jsp
labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/DataCollectorAction.java
labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFiler.java
labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerJob.java
Log:
bug:JBESB-738
Fix JmsConnectionPool Connection leak, remove deploy target from management-web,
and change the name of the war to jbossesb.
Modified: labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/DataCollectorAction.java
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/DataCollectorAction.java 2007-08-24 13:13:28 UTC (rev 14526)
+++ labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/client/DataCollectorAction.java 2007-08-24 13:18:43 UTC (rev 14527)
@@ -75,11 +75,17 @@
esbMessage.getProperties().setProperty("COMMAND_MESSAGE", "foo");
esbMessage.getBody().add(data);
- DeliverOnlyCourier sender = CourierFactory.getCourier(epr);
-
- URI uri = new URI(UUID.randomUUID().toString());
- esbMessage.getHeader().getCall().setMessageID(uri);
- sender.deliver(esbMessage);
+ DeliverOnlyCourier sender = null;
+ try {
+ sender = CourierFactory.getCourier(epr);
+ URI uri = new URI(UUID.randomUUID().toString());
+ esbMessage.getHeader().getCall().setMessageID(uri);
+ sender.deliver(esbMessage);
+ } catch (Exception e) {
+ logger.error("", e);
+ } finally {
+ sender.cleanup();
+ }
}
} else {
logger.error("DataCollectorAction received a message which was not a command message");
Modified: labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFiler.java
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFiler.java 2007-08-24 13:13:28 UTC (rev 14526)
+++ labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFiler.java 2007-08-24 13:18:43 UTC (rev 14527)
@@ -147,21 +147,34 @@
* @param f_sb statistics bean
*/
public void insertStatistics(StatisticsBean f_sb) {
- Session sess = (Session) MonitoringSessionFactory.getInstance().openSession();
- Transaction tx = sess.beginTransaction();
+ Session sess = null;
+ Transaction tx = null;
+ try {
+ sess = (Session) MonitoringSessionFactory.getInstance().openSession();
+ tx = sess.beginTransaction();
- JMXAttribute attr = getAttribute(sess, f_sb.getObjectName(), f_sb.getAttribute());
- if (attr == null) {
- attr = new JMXAttribute(f_sb.getObjectName(), f_sb.getAttribute());
- sess.save(attr);
- insertData(sess, f_sb, attr);
- } else {
- insertData(sess, f_sb, attr);
+ JMXAttribute attr = getAttribute(sess, f_sb.getObjectName(), f_sb.getAttribute());
+ if (attr == null) {
+ attr = new JMXAttribute(f_sb.getObjectName(), f_sb.getAttribute());
+ sess.save(attr);
+ insertData(sess, f_sb, attr);
+ } else {
+ insertData(sess, f_sb, attr);
+ }
+ tx.commit();
+
+ } catch (Exception e) {
+ logger.error("", e);
+ } finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ tx = null;
+
+ sess.flush();
+ sess.close();
+ sess = null;
}
- tx.commit();
-
- sess.flush();
- sess.close();
}
/**
Modified: labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerJob.java
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerJob.java 2007-08-24 13:13:28 UTC (rev 14526)
+++ labs/jbossesb/trunk/product/tools/console/management/src/main/java/org/jboss/soa/esb/monitoring/server/DataFilerJob.java 2007-08-24 13:18:43 UTC (rev 14527)
@@ -56,6 +56,7 @@
public void execute (JobExecutionContext jobExecutionContext)
throws JobExecutionException {
+ DeliverOnlyCourier sender = null;
logger.error("Collect statistics from EPRs");
List list;
try {
@@ -64,7 +65,7 @@
for (int i = 0; i < list.size(); i++) {
EPR epr = (EPR)list.get(i);
Message esbMessage = MessageFactory.getInstance().getMessage();
- DeliverOnlyCourier sender = CourierFactory.getCourier(epr);
+ sender = CourierFactory.getCourier(epr);
esbMessage.getProperties().setProperty("COMMAND_MESSAGE", "foo");
esbMessage.getBody().setByteArray("get statistics".getBytes());
@@ -77,7 +78,7 @@
URI noncmdURI = new URI(UUID.randomUUID().toString());
esbMessage.getHeader().getCall().setMessageID(noncmdURI);
- sender.deliver(noncmdMessage);
+ sender.deliver(noncmdMessage);
}
}
} catch (RegistryException e) {
@@ -90,6 +91,10 @@
logger.error("", e);
} catch (ServiceNotFoundException e) {
logger.error("", e);
+ } finally {
+ if (sender != null) {
+ sender.cleanup();
+ }
}
}
}
Modified: labs/jbossesb/trunk/product/tools/console/management-web/build.xml
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management-web/build.xml 2007-08-24 13:13:28 UTC (rev 14526)
+++ labs/jbossesb/trunk/product/tools/console/management-web/build.xml 2007-08-24 13:18:43 UTC (rev 14527)
@@ -33,7 +33,7 @@
<target name="war" depends="create-webxml,build-jar"
description="Build the management WAR">
- <war destfile="${mgmt.web.dir}/build/management.war"
+ <war destfile="${mgmt.web.dir}/build/jbossesb.war"
webxml="${mgmt.web.dir}/build/web.xml"
basedir="${mgmt.web.dir}/src/main/webapp">
<lib dir="${console.dir}/management/build">
@@ -46,23 +46,6 @@
</war>
</target>
- <target name="deploy" depends="war" description="Deploy the WAR">
- <mkdir dir="${org.jboss.esb.server.home}/server/default/deploy/management.war"/>
- <unzip src="${mgmt.web.dir}/build/management.war"
- dest="${org.jboss.esb.server.home}/server/default/deploy/management.war">
- </unzip>
-
- <property file="${console.dir/management-esb/db.properties"/>
- <property file="${console.dir}/management/${db}.properties"/>
- <copy file="${mgmt.web.dir}/src/main/resources/jbossesbmanagement-service.xml"
- todir="${org.jboss.esb.server.home}/server/default/deploy"
- overwrite="true">
- <filterset>
- <filter token="db.datasource" value="${db.datasource}"/>
- </filterset>
- </copy>
- </target>
-
<path id="toolslib">
<path location="${console.dir}/management/build/management-server.jar"/>
<path location="${console.dir}/management/build/management-client.jar"/>
Modified: labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/attribute.jsp
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/attribute.jsp 2007-08-24 13:13:28 UTC (rev 14526)
+++ labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/attribute.jsp 2007-08-24 13:18:43 UTC (rev 14527)
@@ -45,42 +45,46 @@
timerange = Integer.parseInt(request.getParameter("timerange"));
} catch (Exception e) {}
-Session sess = MonitoringSessionFactory.getInstance().openSession();
-Transaction tx = sess.beginTransaction();
-JMXAttribute jmxa = (JMXAttribute) sess.load(JMXAttribute.class, id);
-
-Integer intId = new Integer(id.intValue());
-List dataList = StatisticsHelper.getData(sess, servername, intId, new Integer(timerange));
-
-String attribute = jmxa.getAttribute();
-int attributeType = StatisticsHelper.getAttributeType(attribute);
+Session sess = null;
+Transaction tx = null;
+try {
+ sess = MonitoringSessionFactory.getInstance().openSession();
+ tx = sess.beginTransaction();
-TimeSeriesChartProducer tscp = new TimeSeriesChartProducer(attribute, Minute.class);
-JFreeChart jfc = tscp.createChart(attribute);
-
-for (int i = 0; i < dataList.size(); i++) {
- JMXData jmxd = (JMXData) dataList.get(i);
- switch (attributeType) {
- case StatisticsHelper.COUNT_ATTRIBUTE:
- case StatisticsHelper.BYTES_ATTRIBUTE:
- tscp.addMinute(new Minute(jmxd.getStatdate()), jmxd.getCountvalue());
- break;
- case StatisticsHelper.TIME_ATTRIBUTE:
- tscp.addMinute(new Minute(jmxd.getStatdate()), jmxd.getTimevalue());
- break;
- default:
- break;
+ JMXAttribute jmxa = (JMXAttribute) sess.load(JMXAttribute.class, id);
+
+ Integer intId = new Integer(id.intValue());
+ List dataList = StatisticsHelper.getData(sess, servername, intId, new Integer(timerange));
+
+ String attribute = jmxa.getAttribute();
+ int attributeType = StatisticsHelper.getAttributeType(attribute);
+
+ TimeSeriesChartProducer tscp = new TimeSeriesChartProducer(attribute, Minute.class);
+ JFreeChart jfc = tscp.createChart(attribute);
+
+ for (int i = 0; i < dataList.size(); i++) {
+ JMXData jmxd = (JMXData) dataList.get(i);
+ switch (attributeType) {
+ case StatisticsHelper.COUNT_ATTRIBUTE:
+ case StatisticsHelper.BYTES_ATTRIBUTE:
+ tscp.addMinute(new Minute(jmxd.getStatdate()), jmxd.getCountvalue());
+ break;
+ case StatisticsHelper.TIME_ATTRIBUTE:
+ tscp.addMinute(new Minute(jmxd.getStatdate()), jmxd.getTimevalue());
+ break;
+ default:
+ break;
+ }
}
-}
-
-if ((attributeType == StatisticsHelper.COUNT_ATTRIBUTE)
- || (attributeType == StatisticsHelper.BYTES_ATTRIBUTE)
- || (attributeType == StatisticsHelper.TIME_ATTRIBUTE)) {
-String image = "image-" + session.getId() + ".jpg";
-String realFile = session.getServletContext().getRealPath("") + File.separator
- + image;
-File file = new File(realFile);
-tscp.saveChart(attribute, file);
+
+ if ((attributeType == StatisticsHelper.COUNT_ATTRIBUTE)
+ || (attributeType == StatisticsHelper.BYTES_ATTRIBUTE)
+ || (attributeType == StatisticsHelper.TIME_ATTRIBUTE)) {
+ String image = "image-" + session.getId() + ".jpg";
+ String realFile = session.getServletContext().getRealPath("") + File.separator
+ + image;
+ File file = new File(realFile);
+ tscp.saveChart(attribute, file);
%>
<center>
<img src="/management/<%=image%>">
@@ -151,8 +155,18 @@
}
}
-sess.flush();
-sess.close();
+} catch (Exception e) {
+ e.printStackTrace();
+} finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ tx = null;
+
+ sess.flush();
+ sess.close();
+ sess = null;
+}
%>
</table>
</center>
Modified: labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/index.jsp
===================================================================
--- labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/index.jsp 2007-08-24 13:13:28 UTC (rev 14526)
+++ labs/jbossesb/trunk/product/tools/console/management-web/src/main/webapp/index.jsp 2007-08-24 13:18:43 UTC (rev 14527)
@@ -31,11 +31,14 @@
</nobr>
</form>
<%
-Session sess = MonitoringSessionFactory.getInstance().openSession();
-Transaction tx = sess.beginTransaction();
-List serverNames = StatisticsHelper.getServerNames(sess);
-for (int i = 0; i<serverNames.size(); i++) {
- String serverName = (String) serverNames.get(i);
+Session sess = null;
+Transaction tx = null;
+try {
+ sess = MonitoringSessionFactory.getInstance().openSession();
+ tx = sess.beginTransaction();
+ List serverNames = StatisticsHelper.getServerNames(sess);
+ for (int i = 0; i<serverNames.size(); i++) {
+ String serverName = (String) serverNames.get(i);
%>
<hr>
<h1><code><%=serverName%></code></h1>
@@ -62,14 +65,23 @@
}
-if (serverNames.size() == 0) {
- %>
- No records found in database.
- <%
+ if (serverNames.size() == 0) {
+ %>
+ No records found in database.
+ <%
+ }
+} catch (Exception e) {
+ e.printStackTrace();
+} finally {
+ if (tx.isActive()) {
+ tx.rollback();
+ }
+ tx = null;
+
+ sess.flush();
+ sess.close();
+ sess = null;
}
-sess.flush();
-sess.close();
%>
- </ul>
</body>
</html>
More information about the jboss-svn-commits
mailing list