[jboss-cvs] JBossAS SVN: r71010 - branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 19 11:53:52 EDT 2008
Author: darran.lofthouse at jboss.com
Date: 2008-03-19 11:53:52 -0400 (Wed, 19 Mar 2008)
New Revision: 71010
Modified:
branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java
Log:
[JBPAPP-687] JmsActivation reconnection could start multiple threads.
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java 2008-03-19 15:47:35 UTC (rev 71009)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java 2008-03-19 15:53:52 UTC (rev 71010)
@@ -78,6 +78,9 @@
/** Whether delivery is active */
protected SynchronizedBoolean deliveryActive;
+
+ // Whether we are in the failure recovery loop
+ private SynchronizedBoolean inFailure = new SynchronizedBoolean(false);
/** The jms provider adapter */
protected JMSProviderAdapter adapter;
@@ -222,41 +225,52 @@
deliveryActive.set(false);
teardown();
}
-
+
/**
* Handles any failure by trying to reconnect
+ *
+ * @param failure the failure
*/
public void handleFailure(Throwable failure)
{
log.warn("Failure in jms activation " + spec, failure);
- while (deliveryActive.get())
+ // Only enter the failure loop once
+ if (inFailure.set(true))
+ return;
+ try
{
- teardown();
- try
+ while (deliveryActive.get())
{
- Thread.sleep(spec.getReconnectIntervalLong());
- }
- catch (InterruptedException e)
- {
- log.debug("Interrupted trying to reconnect " + spec, e);
- break;
- }
+ teardown();
+ try
+ {
+ Thread.sleep(spec.getReconnectIntervalLong());
+ }
+ catch (InterruptedException e)
+ {
+ log.debug("Interrupted trying to reconnect " + spec, e);
+ break;
+ }
- log.info("Attempting to reconnect " + spec);
- try
- {
- setup();
- log.info("Reconnected with messaging provider.");
- break;
+ log.info("Attempting to reconnect " + spec);
+ try
+ {
+ setup();
+ log.info("Reconnected with messaging provider.");
+ break;
+ }
+ catch (Throwable t)
+ {
+ log.error("Unable to reconnect " + spec, t);
+ }
}
- catch (Throwable t)
- {
- log.error("Unable to reconnect " + spec, t);
- }
-
-
}
+ finally
+ {
+ // Leaving failure recovery loop
+ inFailure.set(false);
+ }
}
public void onException(JMSException exception)
@@ -401,6 +415,7 @@
*/
protected void teardownDestination()
{
+ destination = null;
}
/**
@@ -571,6 +586,7 @@
{
log.debug("Error clearing the pool " + pool, t);
}
+ pool = null;
}
/**
More information about the jboss-cvs-commits
mailing list