You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2012/05/20 19:17:55 UTC

svn commit: r1340771 - /uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java

Author: cwiklik
Date: Sun May 20 17:17:54 2012
New Revision: 1340771

URL: http://svn.apache.org/viewvc?rev=1340771&view=rev
Log:
UIMA-2404 close JMS Sessions and then close a Connection to a broker

Modified:
    uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java

Modified: uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java?rev=1340771&r1=1340770&r2=1340771&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java Sun May 20 17:17:54 2012
@@ -74,6 +74,7 @@ import org.apache.uima.aae.monitor.stati
 import org.apache.uima.adapter.jms.JmsConstants;
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.impl.XmiSerializationSharedData;
+import org.apache.uima.resource.ResourceProcessException;
 import org.apache.uima.resource.metadata.ProcessingResourceMetaData;
 import org.apache.uima.util.Level;
 
@@ -1887,16 +1888,19 @@ public class JmsOutputChannel implements
               if (brokerDestinations.getConnection() != null
                       && !((ActiveMQConnection) brokerDestinations.getConnection()).isClosed()) {
                 try {
-                  brokerDestinations.getConnection().stop();
-                  brokerDestinations.getConnection().close();
-                  brokerDestinations.setConnection(null);
+                  for (Entry<Object, JmsEndpointConnection_impl> endpoints : brokerDestinations.endpointMap
+                          .entrySet()) {
+                    endpoints.getValue().close(); // close session and producer
+                  }
                 } catch (Exception e) {
                   // Ignore this for now. Attempting to close connection that has been closed
                   // Ignore we are shutting down
                 } finally {
-                  for (Entry<Object, JmsEndpointConnection_impl> endpoints : brokerDestinations.endpointMap
-                          .entrySet()) {
-                    endpoints.getValue().close(); // close session and producer
+                  try {
+                    brokerDestinations.getConnection().stop();
+                    brokerDestinations.getConnection().close();
+                    brokerDestinations.setConnection(null);
+                  } catch( Exception e) {
                   }
                   //  If this is a reply to a client, use the same broker URL that manages this service input queue.
                   //  Otherwise this is a request so use a broker specified in the endpoint object.