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 2014/06/02 21:07:41 UTC
svn commit: r1599311 -
/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java
Author: cwiklik
Date: Mon Jun 2 19:07:40 2014
New Revision: 1599311
URL: http://svn.apache.org/r1599311
Log:
UIMA-3843 Close jms connection on exception on openChannel()
Modified:
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java
Modified: uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java?rev=1599311&r1=1599310&r2=1599311&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java Mon Jun 2 19:07:40 2014
@@ -242,10 +242,10 @@ public class JmsEndpointConnection_impl
factory.setWatchTopicAdvisories(false);
// Create shared jms connection to a broker
conn = factory.createConnection();
- conn.start();
factory.setDispatchAsync(true);
factory.setUseAsyncSend(true);
factory.setCopyMessageOnSend(false);
+ conn.start();
// Cache the connection. There should only be one connection in the jvm
// per unique broker url.
brokerDestinations.setConnection(conn);
@@ -265,6 +265,11 @@ public class JmsEndpointConnection_impl
break; // Got the connection, break out of the while-loop
} catch( JMSException jex) {
+ if ( conn != null ) {
+ try {
+ conn.close();
+ } catch( Exception ee) {}
+ }
// if ( logConnectionProblem ) {
logConnectionProblem = false; // log once
// Check if unable to connect to the broker and retry ...
@@ -280,6 +285,13 @@ public class JmsEndpointConnection_impl
}
// }
this.wait(1000); // wait between retries
+ } catch ( Exception ee) {
+ ee.printStackTrace();
+ if ( conn != null ) {
+ try {
+ conn.close();
+ } catch( Exception eee) {}
+ }
}
} //while
if ( logConnectionProblem == false ) { // we had conectivity problem. Log the fact that it was recovered
@@ -291,11 +303,17 @@ public class JmsEndpointConnection_impl
}
}
- }
+ }
} catch( Exception exc) {
- throw exc; // rethrow
+ if ( conn != null ) {
+ try {
+ conn.close();
+ } catch( Exception ee) {}
+ }
+ throw exc; // rethrow
} finally {
connectionSemaphore.release();
+
}
connectionCreationTimestamp = System.nanoTime();