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/03/04 17:01:42 UTC

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

Author: cwiklik
Date: Fri Mar  4 16:01:42 2011
New Revision: 1078026

URL: http://svn.apache.org/viewvc?rev=1078026&view=rev
Log:
UIMA-2072 fixed log message on send failure to indicate the target of the message: either delegate or client 

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=1078026&r1=1078025&r2=1078026&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 Fri Mar  4 16:01:42 2011
@@ -509,11 +509,20 @@ public class JmsEndpointConnection_impl 
 
   public boolean send(final Message aMessage, long msgSize, boolean startTimer, boolean failOnJMSException) {
     String destinationName = "";
+    String target = "Delegate";
 
     try {
       int msgType = aMessage.getIntProperty(AsynchAEMessage.MessageType);
       int command = aMessage.getIntProperty(AsynchAEMessage.Command);
-
+      boolean newCAS = false;
+      if ( aMessage.propertyExists(AsynchAEMessage.CasSequence) &&
+              aMessage.getLongProperty(AsynchAEMessage.CasSequence) > 0 ) {
+        newCAS = true;
+      }
+      
+      if ( msgType == AsynchAEMessage.Response || (msgType == AsynchAEMessage.Request && newCAS) ) {
+        target = "Client";
+      }
       Endpoint masterEndpoint = null;
       if ( delegateEndpoint != null && delegateEndpoint.getDelegateKey() != null ) {
         masterEndpoint = ((AggregateAnalysisEngineController) controller).lookUpEndpoint(
@@ -533,7 +542,7 @@ public class JmsEndpointConnection_impl 
           map.put(AsynchAEMessage.Command, AsynchAEMessage.Process);
           map.put(AsynchAEMessage.CasReference, aMessage.getStringProperty(AsynchAEMessage.CasReference));
           map.put(AsynchAEMessage.Endpoint, masterEndpoint);
-          Exception e = new DelegateConnectionLostException("Controller:"+controller.getComponentName()+" Lost Connection to Delegate:"+masterEndpoint.getDelegateKey());
+          Exception e = new DelegateConnectionLostException("Controller:"+controller.getComponentName()+" Lost Connection to "+target+ ":"+masterEndpoint.getDelegateKey());
           if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
             
             UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
@@ -602,9 +611,17 @@ public class JmsEndpointConnection_impl 
         if ( delegateEndpoint != null ) {
           delegateEndpoint.getDelegateKey();
         }
-        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
-                "send", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
-                "UIMAEE_service_delivery_exception__WARNING",new Object[] { controller.getComponentName(), key});
+        if ( "Client".equals(target) ) {
+          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
+                  "send", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                  "UIMAEE_service_delivery_to_client_exception__WARNING",
+                  new Object[] { controller.getComponentName(), ((ActiveMQDestination) delegateEndpoint.getDestination())
+            .getPhysicalName()});
+        } else {
+          UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
+                  "send", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
+                  "UIMAEE_service_delivery_exception__WARNING",new Object[] { controller.getComponentName(), key});
+        }
 
         UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
                 "send", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,