return;
}
}
// make sure we are initialized
ServerConfig config = getConfig();
// make sure we aren't started yet
if (started)
throw new IllegalStateException("already started");
ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
try
{
ClassLoader myCL = getClass().getClassLoader();
Thread.currentThread().setContextClassLoader(myCL);
// See how long it takes us to start up
StopWatch watch = new StopWatch(true);
// Remember when we we started
startDate = new Date();
// Install the shutdown hook
shutdownHook = new ShutdownHook();
shutdownHook.setDaemon(true);
try
{
Runtime.getRuntime().addShutdownHook(shutdownHook);
if (log != null && log.isDebugEnabled())
{
log.debug("Shutdown hook added " + shutdownHook);
}
}
catch (Exception e)
{
log.warn("Failed to add shutdown hook; ignoring", e);
}
// Do the main start
doStart(watch);
// TODO Fix the TCL hack used here!
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try
{
// Run the bootstraps
for (Bootstrap bootstrap : bootstraps)
{
Thread.currentThread().setContextClassLoader(bootstrap.getClass().getClassLoader());
startedBootstraps.add(0, bootstrap);
bootstrap.start(this);
}
}
finally
{
Thread.currentThread().setContextClassLoader(cl);
}
if (config.isInstallLifeThread())
{
lifeThread = new LifeThread();
if (log != null && log.isDebugEnabled())
{
log.debug("Installing life thread " + lifeThread);