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/12/03 16:05:54 UTC
svn commit: r886804 -
/incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java
Author: cwiklik
Date: Thu Dec 3 15:05:53 2009
New Revision: 886804
URL: http://svn.apache.org/viewvc?rev=886804&view=rev
Log:
UIMA-1292 Fixed a bug that prevented the listener from retrying a connection on service startup when broker is not available.
Modified:
incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java
Modified: incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java
URL: http://svn.apache.org/viewvc/incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java?rev=886804&r1=886803&r2=886804&view=diff
==============================================================================
--- incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java (original)
+++ incubator/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/activemq/UimaDefaultMessageListenerContainer.java Thu Dec 3 15:05:53 2009
@@ -357,7 +357,10 @@
if ( controller != null ) {
controller.changeState(ServiceState.FAILED);
}
- if (endpoint == null) {
+ // check if endpoint object has been fully initialized. If it is not
+ // initialized, most likely the broker is not available and we
+ // go into a silent re-connect retry.
+ if (endpoint == null || endpoint.getDestination() == null ) {
super.handleListenerSetupFailure(t, true);
String controllerId = "";
if (controller != null) {
@@ -371,9 +374,8 @@
}
System.out.println(controllerId + " Listener Unable to Connect to Broker:" + getBrokerUrl()
+ " Retrying ....");
- // This code executes during initialization of the service. The Endpoint is not yet
- // available. The connection to a broker cannot be established. Keep trying until
- // the broker becomes available.
+ // Use Spring to retry connection until successful. This call is
+ // blocking this thread.
refreshConnectionUntilSuccessful();
if ( controller != null ) {
controller.changeState(ServiceState.RUNNING);
@@ -388,14 +390,12 @@
}
return;
}
-
// Connection failure that occurs AFTER the service initialized.
if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, CLASS_NAME.getName(),
"handleListenerSetupFailure", JmsConstants.JMS_LOG_RESOURCE_BUNDLE,
"UIMAJMS_exception__WARNING", new Object[] { JmsConstants.threadName(), t });
}
-
synchronized (mux) {
if (!failed) {
// Check if this listener is attached to a temp queue. If so, this is a listener