Author: gnodet
Date: Wed Feb 1 09:29:05 2006
New Revision: 374119
URL: http://svn.apache.org/viewcvs?rev=374119&view=rev
Log:
Need to check if the server pool is closing before calling reconnect, as the
method is synchronized and can cause deadlocks
Modified:
incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
Modified:
incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
URL:
http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java?rev=374119&r1=374118&r2=374119&view=diff
==============================================================================
---
incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
(original)
+++
incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQEndpointWorker.java
Wed Feb 1 09:29:05 2006
@@ -145,7 +145,9 @@
connection.start();
connection.setExceptionListener(new ExceptionListener() {
public void onException(JMSException error) {
- reconnect(error);
+ if (!serverSessionPool.isClosing()) {
+ reconnect(error);
+ }
}
});
@@ -233,23 +235,21 @@
}
synchronized private void reconnect(JMSException error){
- if(!serverSessionPool.isClosing()){
- log.debug("Reconnect cause: ",error);
- // Only log errors if the server is really down.. And not a temp
failure.
- if(reconnectDelay==MAX_RECONNECT_DELAY){
- log.info("Endpoint connection to JMS broker failed:
"+error.getMessage());
- log.info("Endpoint will try to reconnect to the JMS broker in
"+(MAX_RECONNECT_DELAY/1000)+" seconds");
- }
- try{
- disconnect();
- Thread.sleep(reconnectDelay);
- // Use exponential rollback.
- reconnectDelay*=2;
- if(reconnectDelay>MAX_RECONNECT_DELAY)
- reconnectDelay=MAX_RECONNECT_DELAY;
- connect();
- }catch(InterruptedException e){}
+ log.debug("Reconnect cause: ",error);
+ // Only log errors if the server is really down.. And not a temp
failure.
+ if (reconnectDelay == MAX_RECONNECT_DELAY) {
+ log.info("Endpoint connection to JMS broker failed: " +
error.getMessage());
+ log.info("Endpoint will try to reconnect to the JMS broker in
"+(MAX_RECONNECT_DELAY/1000)+" seconds");
}
+ try {
+ disconnect();
+ Thread.sleep(reconnectDelay);
+ // Use exponential rollback.
+ reconnectDelay*=2;
+ if (reconnectDelay > MAX_RECONNECT_DELAY)
+ reconnectDelay=MAX_RECONNECT_DELAY;
+ connect();
+ } catch(InterruptedException e) {}
}
protected void registerThreadSession(Session session) {