[jboss-cvs] JBoss Messaging SVN: r6491 - in trunk/examples/jms: management/src/org/jboss/jms/example and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 20 08:03:00 EDT 2009


Author: jmesnil
Date: 2009-04-20 08:03:00 -0400 (Mon, 20 Apr 2009)
New Revision: 6491

Modified:
   trunk/examples/jms/expiry/src/org/jboss/jms/example/ExpiryExample.java
   trunk/examples/jms/management/src/org/jboss/jms/example/ManagementExample.java
Log:
removed duplicated code

* JNDI context is closed in the finally block

Modified: trunk/examples/jms/expiry/src/org/jboss/jms/example/ExpiryExample.java
===================================================================
--- trunk/examples/jms/expiry/src/org/jboss/jms/example/ExpiryExample.java	2009-04-20 11:53:04 UTC (rev 6490)
+++ trunk/examples/jms/expiry/src/org/jboss/jms/example/ExpiryExample.java	2009-04-20 12:03:00 UTC (rev 6491)
@@ -121,13 +121,11 @@
          // Step 21. the actual expiration time is stored in the _JBM_ORIG_DESTINATION property
          System.out.println("*Actual expiration time* of the expired message: " + messageReceived.getLongProperty("_JBM_ACTUAL_EXPIRY"));
 
-         initialContext.close();
-         
          return true;
       }
       finally
       {
-         // Step 22. Be sure to close our JMS resources!
+         // Step 22. Be sure to close the resources!
          if (initialContext != null)
          {
             initialContext.close();

Modified: trunk/examples/jms/management/src/org/jboss/jms/example/ManagementExample.java
===================================================================
--- trunk/examples/jms/management/src/org/jboss/jms/example/ManagementExample.java	2009-04-20 11:53:04 UTC (rev 6490)
+++ trunk/examples/jms/management/src/org/jboss/jms/example/ManagementExample.java	2009-04-20 12:03:00 UTC (rev 6491)
@@ -134,13 +134,11 @@
          TextMessage messageReceived = (TextMessage) messageConsumer.receive(5000);
          System.out.println("Received message: " + messageReceived);
 
-         initialContext.close();
-         
          return true;
       }
       finally
       {
-         //Step 23. Be sure to close our JMS resources!
+         //Step 23. Be sure to close the resources!
          if (initialContext != null)
          {
             initialContext.close();




More information about the jboss-cvs-commits mailing list