geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r411811 - /geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/PingServlet2MDBQueue.java
Date Mon, 05 Jun 2006 15:16:24 GMT
Author: djencks
Date: Mon Jun  5 08:16:23 2006
New Revision: 411811

URL: http://svn.apache.org/viewvc?rev=411811&view=rev
Log:
Close all those connections we just started opening

Modified:
    geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/PingServlet2MDBQueue.java

Modified: geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/PingServlet2MDBQueue.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/PingServlet2MDBQueue.java?rev=411811&r1=411810&r2=411811&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/PingServlet2MDBQueue.java
(original)
+++ geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/PingServlet2MDBQueue.java
Mon Jun  5 08:16:23 2006
@@ -93,16 +93,19 @@
                 int iter = TradeConfig.getPrimIterations();
                 for (int ii = 0; ii < iter; ii++) {
                     Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-                    MessageProducer producer = sess.createProducer(queue);
+                    try {
+                        MessageProducer producer = sess.createProducer(queue);
 
-                    message = sess.createTextMessage();
+                        message = sess.createTextMessage();
 
-                    String command = "ping";
-                    message.setStringProperty("command", command);
-                    message.setLongProperty("publishTime", System.currentTimeMillis());
-                    message.setText("Ping message for queue java:comp/env/jms/TradeBrokerQueue
sent from PingServlet2MDBQueue at " + new java.util.Date());
-                    producer.send(message);
-                    sess.close();
+                        String command = "ping";
+                        message.setStringProperty("command", command);
+                        message.setLongProperty("publishTime", System.currentTimeMillis());
+                        message.setText("Ping message for queue java:comp/env/jms/TradeBrokerQueue
sent from PingServlet2MDBQueue at " + new java.util.Date());
+                        producer.send(message);
+                    } finally {
+                        sess.close();
+                    }
                 }
 
                 //write out the output
@@ -119,6 +122,8 @@
             catch (Exception e) {
                 Log.error("PingServlet2MDBQueue.doGet(...):exception posting message to TradeBrokerQueue
destination ");
                 throw e;
+            } finally {
+                conn.close();
             }
         } //this is where I actually handle the exceptions
         catch (Exception e) {



Mime
View raw message