// start the application
// in a separate thread and then check that the wrapper is up after a
// max timeout
// but return as soon as possible to the windows service controller
final long maxStartTime = w.getMaxStartTime();
final Future future = pool.submit(new Runnable()
{
public void run()
{
try
{
Thread.yield();
wList.startAll();
}
catch (Throwable ex)
{
ex.printStackTrace();
w.getWrapperLogger().info("Win Service: error starting wrapper " + ex.getMessage());
Runtime.getRuntime().halt(999);
}
}
});
pool.execute(new Runnable()
{
public void run()
{
try
{
future.get(maxStartTime, TimeUnit.MILLISECONDS);
}
catch (Exception ex)
{
ex.printStackTrace();
w.getWrapperLogger().info("Win Service: wrapper did not start within " + maxStartTime + " ms " + ex.getMessage());