summaryrefslogtreecommitdiff
path: root/java/src/IceBox/ServiceManagerI.java
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2011-06-06 13:18:17 -0700
committerMark Spruiell <mes@zeroc.com>2011-06-06 13:18:17 -0700
commitea8288680e2caae80f0966ba16bde27ce57179fc (patch)
treead22e7ec390bcac385cb2bf0f39f9852921d9404 /java/src/IceBox/ServiceManagerI.java
parentbug 5128 - assertion failure in IceSSL transceiver (diff)
downloadice-ea8288680e2caae80f0966ba16bde27ce57179fc.tar.bz2
ice-ea8288680e2caae80f0966ba16bde27ce57179fc.tar.xz
ice-ea8288680e2caae80f0966ba16bde27ce57179fc.zip
minor cleanup to IceBox error handling and log messages
Diffstat (limited to 'java/src/IceBox/ServiceManagerI.java')
-rw-r--r--java/src/IceBox/ServiceManagerI.java62
1 files changed, 31 insertions, 31 deletions
diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java
index 9a35b3c88a6..09cd7c4b51b 100644
--- a/java/src/IceBox/ServiceManagerI.java
+++ b/java/src/IceBox/ServiceManagerI.java
@@ -73,7 +73,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: exception in start for service " + info.name + "\n" + sw.toString());
+ _logger.warning("ServiceManager: exception while starting service " + info.name + ":\n" + sw.toString());
}
synchronized(this)
@@ -145,8 +145,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" +
- sw.toString());
+ _logger.warning("ServiceManager: exception while stopping service " + info.name + ":\n" + sw.toString());
}
synchronized(this)
@@ -228,7 +227,6 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
}
-
public void
shutdown(Ice.Current current)
{
@@ -444,23 +442,13 @@ public class ServiceManagerI extends _ServiceManagerDisp
stopAll();
return 1;
}
- catch(Ice.LocalException ex)
- {
- java.io.StringWriter sw = new java.io.StringWriter();
- java.io.PrintWriter pw = new java.io.PrintWriter(sw);
- ex.printStackTrace(pw);
- pw.flush();
- _logger.error("ServiceManager: " + ex + "\n" + sw.toString());
- stopAll();
- return 1;
- }
- catch(java.lang.Exception ex)
+ catch(Throwable ex)
{
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
ex.printStackTrace(pw);
pw.flush();
- _logger.error("ServiceManager: unknown exception\n" + sw.toString());
+ _logger.error("ServiceManager: caught exception:\n" + sw.toString());
stopAll();
return 1;
}
@@ -511,8 +499,14 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
catch(java.lang.reflect.InvocationTargetException ex)
{
- throw new FailureException(
- "ServiceManager: service constructor " + className + "(Ice.Communicator) threw an exception", ex);
+ if(ex.getCause() != null)
+ {
+ throw ex.getCause();
+ }
+ else
+ {
+ throw new FailureException("ServiceManager: exception in service constructor for " + className, ex);
+ }
}
if(obj == null)
@@ -544,6 +538,14 @@ public class ServiceManagerI extends _ServiceManagerDisp
{
throw new FailureException("ServiceManager: unable to instantiate class " + className, ex);
}
+ catch(FailureException ex)
+ {
+ throw ex;
+ }
+ catch(Throwable ex)
+ {
+ throw new FailureException("ServiceManager: exception in service constructor for " + className, ex);
+ }
//
// Invoke Service::start().
@@ -635,8 +637,8 @@ public class ServiceManagerI extends _ServiceManagerDisp
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: exception in shutting down communicator for service "
- + service + "\n" + sw.toString());
+ _logger.warning("ServiceManager: exception while shutting down communicator for service "
+ + service + ":\n" + sw.toString());
}
try
@@ -649,8 +651,8 @@ public class ServiceManagerI extends _ServiceManagerDisp
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: exception in destroying communciator for service"
- + service + "\n" + sw.toString());
+ _logger.warning("ServiceManager: exception while destroying communicator for service "
+ + service + ":\n" + sw.toString());
}
}
throw ex;
@@ -664,7 +666,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
catch(Throwable ex)
{
- throw new FailureException("ServiceManager: exception while starting service " + service + ": " + ex, ex);
+ throw new FailureException("ServiceManager: exception while starting service " + service, ex);
}
}
@@ -702,13 +704,13 @@ public class ServiceManagerI extends _ServiceManagerDisp
info.status = StatusStopped;
stoppedServices.add(info.name);
}
- catch(java.lang.Exception e)
+ catch(Throwable e)
{
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" +
+ _logger.warning("ServiceManager: exception while stopping service " + info.name + ":\n" +
sw.toString());
}
}
@@ -742,7 +744,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" +
+ _logger.warning("ServiceManager: exception while stopping service " + info.name + ":\n" +
sw.toString());
}
@@ -756,7 +758,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" +
+ _logger.warning("ServiceManager: exception while stopping service " + info.name + ":\n" +
sw.toString());
}
}
@@ -768,14 +770,13 @@ public class ServiceManagerI extends _ServiceManagerDisp
{
_sharedCommunicator.destroy();
}
- catch(Exception e)
+ catch(java.lang.Exception e)
{
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
pw.flush();
- _logger.warning("ServiceManager: unknown exception while destroying shared communicator:\n" +
- sw.toString());
+ _logger.warning("ServiceManager: exception while destroying shared communicator:\n" + sw.toString());
}
_sharedCommunicator = null;
}
@@ -844,7 +845,6 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
}
-
private synchronized void
removeObserver(ServiceObserverPrx observer, Ice.LocalException ex)
{