Commit 7a2c26ab authored by Andre Freyssinet's avatar Andre Freyssinet
Browse files

Prints the exception message in case of error during a service starting.

parent e9011a19
/*
* Copyright (C) 2001 - 2021 ScalAgent Distributed Technologies
* Copyright (C) 2001 - 2022 ScalAgent Distributed Technologies
* Copyright (C) 1996 - 2000 BULL
* Copyright (C) 1996 - 2000 INRIA
*
......@@ -22,6 +22,7 @@ package fr.dyade.aaa.agent;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.HashSet;
......@@ -161,13 +162,20 @@ public class ServiceManager implements Serializable {
if (desc.running)
throw new Exception("Service already running");
Class ptypes[] = new Class[] { String.class, Boolean.TYPE };
Object args[] = new Object[] { desc.getArguments(), new Boolean(!desc.isInitialized()) };
Object args[] = new Object[] { desc.getArguments(), Boolean.valueOf(!desc.isInitialized()) };
Class service = null;
service = Class.forName(desc.getClassName());
Method init = service.getMethod("init", ptypes);
init.invoke(null, args);
try {
init.invoke(null, args);
} catch (InvocationTargetException exc) {
if (xlogmon.isLoggable(BasicLevel.DEBUG))
xlogmon.log(BasicLevel.DEBUG, getName() + ", cannot start service:", exc.getCause());
throw new Exception(exc.getCause().getMessage());
}
desc.running = true;
desc.initialized = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment