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 2009/08/12 19:31:29 UTC

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

Author: cwiklik
Date: Wed Aug 12 17:31:29 2009
New Revision: 803623

URL: http://svn.apache.org/viewvc?rev=803623&view=rev
Log:
UIMA-1433 When inactivity timer pops on a reply queue close the connection to a broker and remove all entries associated with this connection from the connection map 

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

Modified: incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java?rev=803623&r1=803622&r2=803623&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsOutputChannel.java Wed Aug 12 17:31:29 2009
@@ -29,6 +29,7 @@
 import java.util.StringTokenizer;
 import java.util.Timer;
 import java.util.TimerTask;
+import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
 
@@ -894,8 +895,7 @@
 			{
 				return;
 			}
-			JmsEndpointConnection_impl endpointConnection = 
-				getEndpointConnection(anEndpoint);
+			JmsEndpointConnection_impl endpointConnection = getEndpointConnection(anEndpoint);
 
 			TextMessage tm = endpointConnection.produceTextMessage(null);
 			tm.setIntProperty(AsynchAEMessage.Payload, AsynchAEMessage.None); 
@@ -2231,11 +2231,11 @@
       }
       timer.schedule(new TimerTask() {
         public void run() {
-          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.CONFIG)) {
-            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.CONFIG, CLASS_NAME.getName(),
+          if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+            UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
                     "startTimer", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
-                    "UIMAJMS_inactivity_timer_expired_CONFIG",
-                    new Object[] { Thread.currentThread().getName(), inactivityTimeout, endpoint });
+                    "UIMAJMS_inactivity_timer_expired__INFO",
+                    new Object[] { Thread.currentThread().getName(), componentName,  inactivityTimeout, endpoint });
           }
           if (connectionCreationTimestamp <= cachedConnectionCreationTimestamp) {
             try {
@@ -2244,6 +2244,13 @@
                 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
+                    brokerDestinations.endpointMap.remove(endpoints.getValue());
+                  }
+                  connectionMap.remove(endpoint.getServerURI());
                 } catch (Exception e) {
                   // Ignore this for now. Attempting to close connection that has been closed
                   // Ignore we are shutting down