river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rami...@apache.org
Subject svn commit: r639353 - in /incubator/river/jtsk/trunk/src: com/sun/jini/reggie/RegistrarImpl.java net/jini/config/ConfigurationFile.java
Date Thu, 20 Mar 2008 16:53:14 GMT
Author: ramirjf
Date: Thu Mar 20 09:53:13 2008
New Revision: 639353

URL: http://svn.apache.org/viewvc?rev=639353&view=rev
Log:
changes for RIVER-216, RIVER-225, and RIVER-246

-added shutdown hook to reggie to send final
multicast packet when reggie's VM is shutdown

-fixed NullPointerException during reggie destroy

-modified ConfigurationFile to throw ExceptionInInitializerError
if prohibited methods resource cannot be read


Modified:
    incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java
    incubator/river/jtsk/trunk/src/net/jini/config/ConfigurationFile.java

Modified: incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java?rev=639353&r1=639352&r2=639353&view=diff
==============================================================================
--- incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java (original)
+++ incubator/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java Thu Mar 20 09:53:13
2008
@@ -2396,11 +2396,10 @@
 	    socket.close();
 	}
 
-	/* This is a workaround for Thread.interrupt not working on
-	 * MulticastSocket.receive on all platforms.
-	 */
 	public synchronized void interrupt() {
-	    socket.close();
+	    // close socket to interrupt MulticastSocket.receive operation
+	    if (socket != null)
+	        socket.close();
 	    super.interrupt();
 	}
 
@@ -4665,6 +4664,26 @@
 	unicaster.start();
 	multicaster.start();
 	announcer.start();
+        
+        /* Shutdown hook so reggie sends a final announcement
+         * packet if VM is terminated.  If reggie is terminated
+         * through DestroyAdmin.destroy() this hook will have no effect.
+         * A timeout on announcer.join() was considered but not deemed
+         * necessary at this point in time.  
+         */
+	Runtime.getRuntime().addShutdownHook(new Thread( new Runnable() {
+	    public void run() {
+		try {
+		    announcer.interrupt();
+		    announcer.join();
+		} catch (Throwable t) {
+                    logThrow(Level.FINEST, getClass().getName(), 
+                        "run", "exception shutting announcer down",
+                        new Object[]{}, t);
+		}
+	    }
+	}));
+        
         snapshotter.start();
 	if (logger.isLoggable(Level.INFO)) {
 	    logger.log(Level.INFO, "started Reggie: {0}, {1}, {2}",

Modified: incubator/river/jtsk/trunk/src/net/jini/config/ConfigurationFile.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/trunk/src/net/jini/config/ConfigurationFile.java?rev=639353&r1=639352&r2=639353&view=diff
==============================================================================
--- incubator/river/jtsk/trunk/src/net/jini/config/ConfigurationFile.java (original)
+++ incubator/river/jtsk/trunk/src/net/jini/config/ConfigurationFile.java Thu Mar 20 09:53:13
2008
@@ -368,7 +368,7 @@
  *
  * <tr> <th scope="col"> Level <th scope="col"> Description
  *
- * <tr> <td> {@link Level#INFO INFO} <td> problems adding new prohibited
+ * <tr> <td> {@link Level#SEVERE SEVERE} <td> problems adding new prohibited
  *	methods
  *
  * <tr> <td> {@link Levels#FAILED FAILED} <td> problems getting entries,
@@ -453,12 +453,20 @@
 		    }
 		    logger.log(Level.FINER, "Adding prohibited method: {0}",
 			       line);
-		    prohibitedMethods.add(line);
+                    if (validQualifiedIdentifier(line)) {
+                        prohibitedMethods.add(line);
+                    } else {
+                        logger.log(Level.SEVERE, 
+                                "Problem adding prohibited method: {0}", line);
+                        throw new ExceptionInInitializerError(
+                                "Problem adding prohibited method: " + line);
+                    }
 		}
 	    }
 	} catch (IOException e) {
 	    logger.log(
-		Level.INFO, "Problem reading prohibited methods resource", e);
+		Level.SEVERE, "Problem reading prohibited methods resource", e);
+            throw new ExceptionInInitializerError(e);
 	} finally {
 	    if (in != null) {
 		try {



Mime
View raw message