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/28 21:18:38 UTC
svn commit: r808994 -
/incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java
Author: cwiklik
Date: Fri Aug 28 19:18:37 2009
New Revision: 808994
URL: http://svn.apache.org/viewvc?rev=808994&view=rev
Log:
UIMA-1477 Modified to expose JMS Exceptions
Modified:
incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java
Modified: incubator/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/incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java?rev=808994&r1=808993&r2=808994&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/JmsEndpointConnection_impl.java Fri Aug 28 19:18:37 2009
@@ -158,15 +158,15 @@
}
}
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
- "openChannel", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_activemq_open__FINE",
- new Object[] { anEndpointName, brokerUri });
- }
if ( !isOpen() ) {
Connection conn = null;
if (brokerDestinations.getConnection() == null ) {
+ if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.FINE)) {
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.FINE, CLASS_NAME.getName(),
+ "openChannel", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_activemq_open__FINE",
+ new Object[] { anEndpointName, brokerUri });
+ }
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUri);
conn = factory.createConnection();
factory.setDispatchAsync(true);
@@ -230,6 +230,7 @@
catch ( Exception e)
{
boolean rethrow = true;
+ e.printStackTrace();
if ( e instanceof JMSException ) {
rethrow = handleJmsException( (JMSException)e );
@@ -518,8 +519,9 @@
if ( e instanceof JMSException ) {
handleJmsException( (JMSException)e );
} else {
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(), "handleJmsException", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_exception__WARNING", new Object[] { componentName, e});
+ e.printStackTrace();
+ if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(), "send", JmsConstants.JMS_LOG_RESOURCE_BUNDLE, "UIMAJMS_exception__WARNING", new Object[] { componentName, e});
}
}
@@ -566,41 +568,45 @@
if (!failed) {
failed = true;
}
- // Check if the exception is due to deleted queue. ActiveMQ does not identify
- // this condition in the cause, so we need to parse the exception message and
- // compare against "Cannot publish to a deleted Destination" text. If match is
- // found, extract the name of the deleted queue from the exception and log it.
- if (ex.getMessage() != null
- && ex.getMessage().startsWith("Cannot publish to a deleted Destination")) {
- String destName = endpointName;
- int startPos = ex.getMessage().indexOf(':');
- if (startPos > 0) {
- destName = ex.getMessage().substring(startPos);
- }
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
- "handleJmsException", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
- "UIMAJMS_send_failed_deleted_queue_INFO", new Object[] { componentName, destName });
- }
- controller.addEndpointToDoNotProcessList(delegateEndpoint.getDestination().toString());
- return false;
-
- }
- if (ex instanceof ConnectionFailedException && isReplyEndpoint) {
- UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
- "handleJmsException", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
- "UIMAJMS_connection_failure__INFO",
- new Object[] { componentName, serverUri, delegateEndpoint.getDestination() });
- controller.addEndpointToDoNotProcessList(delegateEndpoint.getDestination().toString());
- return false;
+ try {
+ // Check if the exception is due to deleted queue. ActiveMQ does not identify
+ // this condition in the cause, so we need to parse the exception message and
+ // compare against "Cannot publish to a deleted Destination" text. If match is
+ // found, extract the name of the deleted queue from the exception and log it.
+ if (ex.getMessage() != null
+ && ex.getMessage().startsWith("Cannot publish to a deleted Destination")) {
+ String destName = endpointName;
+ int startPos = ex.getMessage().indexOf(':');
+ if (startPos > 0) {
+ destName = ex.getMessage().substring(startPos);
+ }
+ if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
+ "handleJmsException", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAJMS_send_failed_deleted_queue_INFO", new Object[] { componentName, destName, serverUri });
+ }
+ controller.addEndpointToDoNotProcessList(delegateEndpoint.getDestination().toString());
+ return false;
- } else {
- if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+ }
+ if (ex instanceof ConnectionFailedException && isReplyEndpoint) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
"handleJmsException", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
- "UIMAJMS_exception__WARNING", new Object[] { componentName, ex });
+ "UIMAJMS_connection_failure__INFO",
+ new Object[] { componentName, serverUri, delegateEndpoint.getDestination() });
+ controller.addEndpointToDoNotProcessList(delegateEndpoint.getDestination().toString());
+ return false;
+
+ } else {
+ if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.INFO)) {
+ UIMAFramework.getLogger(CLASS_NAME).logrb(Level.INFO, CLASS_NAME.getName(),
+ "handleJmsException", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
+ "UIMAJMS_exception__WARNING", new Object[] { componentName, ex });
+ }
+ ex.printStackTrace();
}
- ex.printStackTrace();
+ } catch ( Exception e) {
+ e.printStackTrace();
}
return true;