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 2011/02/22 18:39:46 UTC
svn commit: r1073433 -
/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java
Author: cwiklik
Date: Tue Feb 22 17:39:46 2011
New Revision: 1073433
URL: http://svn.apache.org/viewvc?rev=1073433&view=rev
Log:
UIMA-2065 Force broker connection to stop in case semaphore acquire throws InterruptedException
Modified:
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java
Modified: uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java?rev=1073433&r1=1073432&r2=1073433&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/client/BaseUIMAAsynchronousEngine_impl.java Tue Feb 22 17:39:46 2011
@@ -225,7 +225,20 @@ public class BaseUIMAAsynchronousEngine_
}
}
-
+ private void stopConnection() {
+ if (sharedConnection != null) {
+ // Remove a client from registry
+ sharedConnection.unregisterClient(this);
+ // The destroy method closes the JMS connection when
+ // the number of
+ // clients becomes 0, otherwise it is a no-op
+ if (sharedConnection.destroy()) {
+ // This needs to be done to invalidate the
+ // object for JUnit tests
+ sharedConnection = null;
+ }
+ }
+ }
public void stop() {
synchronized (connectionMux) {
super.doStop();
@@ -247,7 +260,6 @@ public class BaseUIMAAsynchronousEngine_
consumer.close();
} catch (Exception exx) {}
}
-
try {
// SharedConnection object manages a single JMS connection to
// the broker. If the client is scaled out in the same JVM, the
@@ -257,19 +269,10 @@ public class BaseUIMAAsynchronousEngine_
// connection. The connection is closed when the last client calls stop().
try {
sharedConnectionSemaphore.acquire();
- if (sharedConnection != null) {
- // Remove a client from registry
- sharedConnection.unregisterClient(this);
- // The destroy method closes the JMS connection when
- // the number of
- // clients becomes 0, otherwise it is a no-op
- if (sharedConnection.destroy()) {
- // This needs to be done to invalidate the
- // object for JUnit tests
- sharedConnection = null;
- }
- }
+ stopConnection();
} catch (InterruptedException ex) {
+ // Force connection stop
+ stopConnection();
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(
Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING,