activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r592090 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq: broker/TransportConnector.java transport/discovery/simple/SimpleDiscoveryAgent.java
Date Mon, 05 Nov 2007 17:07:39 GMT
Author: chirino
Date: Mon Nov  5 09:07:38 2007
New Revision: 592090

URL: http://svn.apache.org/viewvc?rev=592090&view=rev
Log:
- Reduced verbosity of logging in TransportConnector so that exceptions should only be in
DEBUG messages.
- Added more logging to SimpleDiscoveryAgent so that we can see what it's doing in regards
to reconnect handling and
  enabled exponential backoff by default.


Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java?rev=592090&r1=592089&r2=592090&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
Mon Nov  5 09:07:38 2007
@@ -170,7 +170,8 @@
             }
 
             private void onAcceptError(Exception error, String remoteHost) {
-                LOG.error("Could not accept connection " + (remoteHost == null ? "" : "from
" + remoteHost) + ": " + error, error);
+                LOG.error("Could not accept connection " + (remoteHost == null ? "" : "from
" + remoteHost) + ": " + error.getMessage());
+                LOG.debug("Reason: " + error.getMessage(), error);
             }
         });
         this.server.setBrokerInfo(brokerInfo);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java?rev=592090&r1=592089&r2=592090&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/simple/SimpleDiscoveryAgent.java
Mon Nov  5 09:07:38 2007
@@ -23,6 +23,8 @@
 import org.apache.activemq.command.DiscoveryEvent;
 import org.apache.activemq.transport.discovery.DiscoveryAgent;
 import org.apache.activemq.transport.discovery.DiscoveryListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * A simple DiscoveryAgent that allows static configuration of the discovered
@@ -32,13 +34,15 @@
  */
 public class SimpleDiscoveryAgent implements DiscoveryAgent {
 
+    private final static Log LOG = LogFactory.getLog(SimpleDiscoveryAgent.class); 
+    
     private long initialReconnectDelay = 1000;
     private long maxReconnectDelay = 1000 * 30;
     private long backOffMultiplier = 2;
-    private boolean useExponentialBackOff;
+    private boolean useExponentialBackOff=true;
     private int maxReconnectAttempts;
     private final Object sleepMutex = new Object();
-    private long minConnectTime = 500;
+    private long minConnectTime = 5000;
     private DiscoveryListener listener;
     private String services[] = new String[] {};
     private final AtomicBoolean running = new AtomicBoolean(false);
@@ -109,11 +113,12 @@
                     // fails right
                     // away.
                     if (event.connectTime + minConnectTime > System.currentTimeMillis())
{
+                        LOG.debug("Failure occured soon after the discovery event was generated.
 It will be clasified as a connection failure: "+event);
 
                         event.connectFailures++;
 
                         if (maxReconnectAttempts > 0 && event.connectFailures
>= maxReconnectAttempts) {
-                            // Don' try to re-connect
+                            LOG.debug("Reconnect attempts exceeded "+maxReconnectAttempts+"
tries.  Reconnecting has been disabled.");
                             return;
                         }
 
@@ -123,6 +128,7 @@
                                     return;
                                 }
 
+                                LOG.debug("Waiting "+event.reconnectDelay+" ms before attepting
to reconnect.");
                                 sleepMutex.wait(event.reconnectDelay);
                             } catch (InterruptedException ie) {
                                 Thread.currentThread().interrupt();



Mime
View raw message