[jboss-cvs] JBossAS SVN: r74784 - in branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow: dlq and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 18 05:58:49 EDT 2008
Author: jesper.pedersen
Date: 2008-06-18 05:58:49 -0400 (Wed, 18 Jun 2008)
New Revision: 74784
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/dlq/AbstractDLQHandler.java
Log:
[JBPAPP-895] Always close JMS connections
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-06-18 09:56:43 UTC (rev 74783)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/JmsActivation.java 2008-06-18 09:58:49 UTC (rev 74784)
@@ -77,7 +77,7 @@
protected MessageEndpointFactory endpointFactory;
/** Whether delivery is active */
- protected SynchronizedBoolean deliveryActive;
+ protected SynchronizedBoolean deliveryActive = new SynchronizedBoolean(false);
// Whether we are in the failure recovery loop
private SynchronizedBoolean inFailure = new SynchronizedBoolean(false);
@@ -213,7 +213,7 @@
*/
public void start() throws ResourceException
{
- deliveryActive = new SynchronizedBoolean(true);
+ deliveryActive.set(true);
ra.getWorkManager().scheduleWork(new SetupActivation());
}
@@ -471,12 +471,29 @@
else
result = qcf.createQueueConnection();
}
+ try
+ {
if (clientID != null)
result.setClientID(clientID);
result.setExceptionListener(this);
log.debug("Using queue connection " + result);
return result;
}
+ catch (Throwable t)
+ {
+ try
+ {
+ result.close();
+ }
+ catch (Exception e)
+ {
+ log.trace("Ignored error closing connection", e);
+ }
+ if (t instanceof Exception)
+ throw (Exception) t;
+ throw new RuntimeException("Error configuring connection", t);
+ }
+ }
/**
* Setup a Topic Connection
@@ -510,12 +527,29 @@
else
result = tcf.createTopicConnection();
}
+ try
+ {
if (clientID != null)
result.setClientID(clientID);
result.setExceptionListener(this);
log.debug("Using topic connection " + result);
return result;
}
+ catch (Throwable t)
+ {
+ try
+ {
+ result.close();
+ }
+ catch (Exception e)
+ {
+ log.trace("Ignored error closing connection", e);
+ }
+ if (t instanceof Exception)
+ throw (Exception) t;
+ throw new RuntimeException("Error configuring connection", t);
+ }
+ }
/**
* Teardown the connection
Modified: branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/dlq/AbstractDLQHandler.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/dlq/AbstractDLQHandler.java 2008-06-18 09:56:43 UTC (rev 74783)
+++ branches/JBPAPP_4_2_0_GA_CP/connector/src/main/org/jboss/resource/adapter/jms/inflow/dlq/AbstractDLQHandler.java 2008-06-18 09:58:49 UTC (rev 74784)
@@ -135,11 +135,29 @@
connection = qcf.createQueueConnection(user, pass);
else
connection = qcf.createQueueConnection();
+ try
+ {
if (clientID != null)
connection.setClientID(clientID);
connection.setExceptionListener(this);
log.debug("Using queue connection " + connection);
}
+ catch (Throwable t)
+ {
+ try
+ {
+ connection.close();
+ }
+ catch (Exception e)
+ {
+ log.trace("Ignored error closing connection", e);
+ }
+ connection = null;
+ if (t instanceof Exception)
+ throw (Exception) t;
+ throw new RuntimeException("Error configuring queue connection", t);
+ }
+ }
/**
* Teardown the DLQ Connection
@@ -158,6 +176,7 @@
{
log.debug("Error closing the connection " + connection, t);
}
+ connection = null;
}
/**
More information about the jboss-cvs-commits
mailing list