public class DependencyWaiterApplicationContextExecutor extends Object implements OsgiBundleApplicationContextExecutor, ContextExecutorAccessor
ConfigurableApplicationContext.refresh() in two
pieces so that beans are not actually created unless the OSGi service imported are present.
Supports both asynch and synch behaviour.| Modifier and Type | Field and Description |
|---|---|
protected DelegatedExecutionOsgiBundleApplicationContext |
delegateContext |
protected DependencyServiceManager |
dependencyDetector
OSGi service dependencyDetector used for detecting dependencies
|
| Constructor and Description |
|---|
DependencyWaiterApplicationContextExecutor(DelegatedExecutionOsgiBundleApplicationContext delegateContext,
boolean syncWait,
List<OsgiServiceDependencyFactory> dependencyFactories) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
The application context is being shutdown.
|
protected DependencyServiceManager |
createDependencyServiceListener(Runnable task) |
void |
fail(Throwable t) |
ContextState |
getContextState() |
OsgiBundleApplicationContextEventMulticaster |
getEventMulticaster() |
protected void |
init()
Do some sanity checks
|
void |
refresh()
Provide a continuation like approach to the application context.
|
void |
setDelegatedMulticaster(OsgiBundleApplicationContextEventMulticaster multicaster)
Sets the multicaster for delegating failing events.
|
void |
setMonitoringCounter(Counter contextsStarted)
Pass in the context counter.
|
void |
setTaskExecutor(org.springframework.core.task.TaskExecutor taskExec) |
void |
setTimeout(long timeout)
Sets the timeout (in ms) for waiting for service dependencies.
|
void |
setWatchdog(Timer watchdog) |
protected void |
stageOne()
Start the first stage of the application context refresh.
|
protected void |
stageTwo() |
protected void |
startWatchDog()
Schedule the watchdog task.
|
protected void |
stopWatchDog() |
protected DependencyServiceManager dependencyDetector
protected final DelegatedExecutionOsgiBundleApplicationContext delegateContext
public DependencyWaiterApplicationContextExecutor(DelegatedExecutionOsgiBundleApplicationContext delegateContext, boolean syncWait, List<OsgiServiceDependencyFactory> dependencyFactories)
public void refresh()
throws org.springframework.beans.BeansException,
IllegalStateException
refresh in interface OsgiBundleApplicationContextExecutororg.springframework.beans.BeansExceptionIllegalStateExceptionprotected void init()
protected void stageOne()
synchronousWait, the current thread can simply end if there are any dependencies (the
default) or wait to either timeout or have all its dependencies met.protected void stageTwo()
public void close()
close in interface OsgiBundleApplicationContextExecutorpublic void fail(Throwable t)
fail in interface ContextExecutorAccessorprotected DependencyServiceManager createDependencyServiceListener(Runnable task)
protected void startWatchDog()
protected void stopWatchDog()
public void setTimeout(long timeout)
timeout - public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExec)
public void setWatchdog(Timer watchdog)
public void setMonitoringCounter(Counter contextsStarted)
asynchCounter - public void setDelegatedMulticaster(OsgiBundleApplicationContextEventMulticaster multicaster)
multicaster - public ContextState getContextState()
getContextState in interface ContextExecutorAccessorpublic OsgiBundleApplicationContextEventMulticaster getEventMulticaster()
getEventMulticaster in interface ContextExecutorAccessorCopyright © 2006–2015. All rights reserved.