[Mulgara-svn] r1133 - trunk/src/jar/server-rmi/java/org/mulgara/server/rmi

pag at mulgara.org pag at mulgara.org
Sun Aug 10 02:12:35 UTC 2008


Author: pag
Date: 2008-08-09 19:12:34 -0700 (Sat, 09 Aug 2008)
New Revision: 1133

Modified:
   trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RmiServer.java
Log:
Catching exceptions during shutdown and printing a more appropriate report. If a server is interrupted in some way (eg the host goes to sleep) then the RMI registry does not respond when we want to stop. This isn't really a problem, since we only stop on shutdown anyway

Modified: trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RmiServer.java
===================================================================
--- trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RmiServer.java	2008-08-10 02:09:55 UTC (rev 1132)
+++ trunk/src/jar/server-rmi/java/org/mulgara/server/rmi/RmiServer.java	2008-08-10 02:12:34 UTC (rev 1133)
@@ -183,8 +183,16 @@
    * @throws NoSuchObjectException The current server is not registered in the registry.
    */
   protected void stopService() throws NamingException, NoSuchObjectException {
-    rmiRegistryContext.unbind(name);
-    UnicastRemoteObject.unexportObject(remoteSessionFactory, true);
+    try {
+      rmiRegistryContext.unbind(name);
+      UnicastRemoteObject.unexportObject(remoteSessionFactory, true);
+    } catch (Exception e) {
+      if (e.getCause() instanceof javax.naming.ServiceUnavailableException) {
+        logger.warn("RMI Server no longer available to be stopped. Abandoning.");
+      } else {
+        logger.warn("Unabled to deregister the RMI service. Abandoning.");
+      }
+    }
   }
 
   /**




More information about the Mulgara-svn mailing list