Author: chirino
Date: Wed Apr 5 11:12:05 2006
New Revision: 391694
URL: http://svn.apache.org/viewcvs?rev=391694&view=rev
Log:
fix for http://jira.activemq.org/jira/browse/AMQ-651
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=391694&r1=391693&r2=391694&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 Apr 5 11:12:05 2006
@@ -234,20 +234,27 @@
connection=null;
}
- synchronized private void reconnect(JMSException error){
+ private void reconnect(JMSException error){
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");
+ long reconnectDelay;
+ synchronized(this) {
+ reconnectDelay = this.reconnectDelay;
+ // 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;
+
+ synchronized(this) {
+ // Use exponential rollback.
+ this.reconnectDelay*=2;
+ if (this.reconnectDelay > MAX_RECONNECT_DELAY)
+ this.reconnectDelay=MAX_RECONNECT_DELAY;
+ }
connect();
} catch(InterruptedException e) {}
}