// The component has already been started
return null;
}
try
{
Startable startable = (Startable)adapter.getComponentInstance();
startable.start();
}
finally
{
alreadyStarted.put(adapter, adapter);
}
}
}
catch (Exception e)
{
error.compareAndSet(null, e);
}
finally
{
Thread.currentThread().setContextClassLoader(oldCl);
ExoContainerContext.setCurrentContainer(oldContainer);
}
return null;
}
});
}
};
if (submittedTasks == null)
{
submittedTasks = new ArrayList<Future<?>>();
}
submittedTasks.add(executor.submit(task));
}
else
{
if (adapter instanceof ComponentAdapterDependenciesAware)
{
ComponentAdapterDependenciesAware<?> cada = (ComponentAdapterDependenciesAware<?>)adapter;
startDependencies(alreadyStarted, startInProgress, error, cada);
}
if (!Startable.class.isAssignableFrom(adapter.getComponentImplementation()))
{
alreadyStarted.put(adapter, adapter);
continue;
}
else if (alreadyStarted.containsKey(adapter))
{
// The component has already been started
continue;
}
synchronized (adapter)
{
if (alreadyStarted.containsKey(adapter))
{
// The component has already been started
continue;
}
try
{
Startable startable = (Startable)adapter.getComponentInstance();
startable.start();
}
catch (Exception e)
{
error.compareAndSet(null, e);
}