You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pa...@apache.org on 2011/05/05 02:05:47 UTC

svn commit: r1099642 - /river/jtsk/skunk/PatsRiver395/src/net/jini/discovery/LookupDiscoveryManager.java

Author: pats
Date: Thu May  5 00:05:47 2011
New Revision: 1099642

URL: http://svn.apache.org/viewvc?rev=1099642&view=rev
Log:
RIVER-395
Remove unnecessary catch code. Add comments documenting the different handling of listener exceptions while the listener is being added vs. afterwards.

Modified:
    river/jtsk/skunk/PatsRiver395/src/net/jini/discovery/LookupDiscoveryManager.java

Modified: river/jtsk/skunk/PatsRiver395/src/net/jini/discovery/LookupDiscoveryManager.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/PatsRiver395/src/net/jini/discovery/LookupDiscoveryManager.java?rev=1099642&r1=1099641&r2=1099642&view=diff
==============================================================================
--- river/jtsk/skunk/PatsRiver395/src/net/jini/discovery/LookupDiscoveryManager.java (original)
+++ river/jtsk/skunk/PatsRiver395/src/net/jini/discovery/LookupDiscoveryManager.java Thu May  5 00:05:47 2011
@@ -1223,6 +1223,11 @@ public class LookupDiscoveryManager impl
      * to date, and will then be notified as new lookup services are
      * discovered or existing lookup services are discarded.
      * <p>
+     * The listener methods may throw Error or RuntimeException subclasses.
+     * They will normally be reported only through the log. If the discovered
+     * method throws Throwable T during the initial discovery of existing
+     * services then this method will also throw T.
+     * <p>
      * If <code>null</code> is input, this method takes no action. If the
      * listener input to this method duplicates (using the <code>equals</code>
      * method) another element in the current set of listeners, no action
@@ -1372,6 +1377,15 @@ public class LookupDiscoveryManager impl
 	return null;
     }
 
+    /**
+     * Notify all listeners for a discovery event. If a listener's method
+     * completes abruptly due to a Throwable, it is logged and processing 
+     * continues.
+     * @param groupsMap mapping from the elements of the registrars of this
+     *               event to the member groups in which each registrar is
+     *               a member.
+     * @param eventType The type of event.
+     */
     private void notifyListener(Map groupsMap, int eventType) {
 	if(groupsMap.isEmpty()) return;
 	ArrayList notifies;
@@ -1390,6 +1404,15 @@ public class LookupDiscoveryManager impl
 	}
     }//end notifyListener
     
+    /**
+     * Notify a specific listener for a discovery event. If the listener's
+     * method throws a Throwable T, this method will also throw T. 
+     * @param l The listener to notify.
+     * @param groupsMap mapping from the elements of the registrars of this
+     *               event to the member groups in which each registrar is
+     *               a member.
+     * @param eventType The type of the event.
+     */
     private void notifyListener(DiscoveryListener l,
                                 Map groupsMap,
                                 int eventType)
@@ -1400,8 +1423,7 @@ public class LookupDiscoveryManager impl
         }
         DiscoveryEvent evt = new DiscoveryEvent(LookupDiscoveryManager.this,
                                                 deepCopy((HashMap)groupsMap) );
-        try {
-            switch(eventType) {
+        switch(eventType) {
             case DISCOVERED:
                 l.discovered(evt);
                 break;
@@ -1411,11 +1433,7 @@ public class LookupDiscoveryManager impl
             case CHANGED:
                 ((DiscoveryChangeListener)l).changed(evt);
                 break;
-            }//end switch
-        } catch (Throwable t) {
-            logger.log(Levels.HANDLED, "a discovery listener failed to process a " +
-                    (eventType == DISCARDED ? "discard" : eventType == DISCOVERED ? "discover" : "changed") + " event", t);
-        }
+        }//end switch
     }//end notifyListener
 
     /** Determines if two sets of registrar member groups have identical