activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r393054 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java
Date Mon, 10 Apr 2006 20:41:14 GMT
Author: chirino
Date: Mon Apr 10 13:41:13 2006
New Revision: 393054

URL: http://svn.apache.org/viewcvs?rev=393054&view=rev
Log:
If multicast is not properly configured.. we run the chance of filling the logs with error
messages on a vanila install.
We now gard against this by only reporting the error mesasge the first time we hit the error.
We keep trying to do mutlicast advertising, but
suppress futher error messages.

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java?rev=393054&r1=393053&r2=393054&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/discovery/multicast/MulticastDiscoveryAgent.java
Mon Apr 10 13:41:13 2006
@@ -73,6 +73,7 @@
     private long keepAliveInterval=DEFAULT_IDLE_TIME;
     private long lastAdvertizeTime=0;
     private AtomicBoolean started=new AtomicBoolean(false);
+    private boolean reportAdvertizeFailed=true;
     
     private final Executor executor = new ThreadPoolExecutor(1, 1, 30, TimeUnit.SECONDS,
new LinkedBlockingQueue(), new ThreadFactory() {
         public Thread newThread(Runnable runable) {
@@ -296,7 +297,7 @@
     }
 
     private void doAdvertizeSelf(){
-        if(selfService!=null){
+        if(selfService!=null ){
             String payload=getType();
             payload+=started.get()?ALIVE:DEAD;
             payload+=DELIMITER+brokerName+DELIMITER;
@@ -305,8 +306,16 @@
                 byte[] data=payload.getBytes();
                 DatagramPacket packet=new DatagramPacket(data,0,data.length,sockAddress);
                 mcast.send(packet);
-            }catch(IOException e){
-                log.error("Failed to advertise our service: "+payload,e);
+            } catch(IOException e) {
+                // If a send fails, chances are all subsequent sends will fail too.. No need
to keep reporting the
+                // same error over and over.
+                if( reportAdvertizeFailed ) {
+                    reportAdvertizeFailed=false;
+                    log.error("Failed to advertise our service: "+payload,e);
+                    if( "Operation not permitted".equals(e.getMessage()) ) {
+                        log.error("The 'Operation not permitted' error has been know to be
caused by improper firewall/network setup.  Please make sure that the OS is properly configured
to allow multicast traffic over: "+mcast.getLocalAddress());
+                    }
+                }
             }
         }
     }



Mime
View raw message