org.springframework.osgi.context.support
Class AbstractDelegatedExecutionApplicationContext
java.lang.Object
org.springframework.core.io.DefaultResourceLoader
org.springframework.context.support.AbstractApplicationContext
org.springframework.context.support.AbstractRefreshableApplicationContext
org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext
- All Implemented Interfaces:
- BeanFactory, DisposableBean, HierarchicalBeanFactory, ListableBeanFactory, ApplicationContext, ApplicationEventPublisher, ConfigurableApplicationContext, Lifecycle, MessageSource, ResourceLoader, ResourcePatternResolver, ConfigurableOsgiBundleApplicationContext, DelegatedExecutionOsgiBundleApplicationContext
- Direct Known Subclasses:
- OsgiBundleXmlApplicationContext
public abstract class AbstractDelegatedExecutionApplicationContext
- extends AbstractOsgiBundleApplicationContext
- implements DelegatedExecutionOsgiBundleApplicationContext
OSGi-specific application context that delegates the execution of its
lifecycle methods to a different class. The main reason behind this is to
'break' the startup of the application context in steps that can be executed
asynchronously.
The refresh()
and AbstractApplicationContext.close()
methods delegate their
execution to an OsgiBundleApplicationContextExecutor
class that
choses how to call the lifecycle submethods.
One can still call the 'traditional' lifecycle methods through
normalRefresh()
and normalClose()
.
- Author:
- Costin Leau
- See Also:
DelegatedExecutionOsgiBundleApplicationContext
Methods inherited from class org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext |
destroyBeans, getBundle, getBundleContext, getClassLoader, getConfigLocations, getDefaultConfigLocations, getResource, getResourceByPath, getResourcePatternResolver, getResources, postProcessBeanFactory, setBundleContext, setClassLoader, setConfigLocations, setPublishContextAsService |
Methods inherited from class org.springframework.context.support.AbstractApplicationContext |
addApplicationListener, addBeanFactoryPostProcessor, addListener, cancelRefresh, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, finishBeanFactoryInitialization, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getDisplayName, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleDependentBeans, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, onRefresh, prepareBeanFactory, prepareRefresh, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, setParent, start, stop, toString |
AbstractDelegatedExecutionApplicationContext
public AbstractDelegatedExecutionApplicationContext()
- Create a new AbstractDelegatedExecutionApplicationContext with no parent.
AbstractDelegatedExecutionApplicationContext
public AbstractDelegatedExecutionApplicationContext(ApplicationContext parent)
- Create a new AbstractDelegatedExecutionApplicationContext with the given
parent context.
- Parameters:
parent
- the parent context
refresh
public void refresh()
throws BeansException,
IllegalStateException
- Delegate execution of refresh method to a third party. This allows
breaking the refresh process into several small pieces providing
continuation-like behavior or completion of the refresh method on several
threads, in a asynch manner.
By default, a
NoDependenciesWaitRefreshExecutor
is used which
executes the refresh method in one go (normal behavior).
- Specified by:
refresh
in interface ConfigurableApplicationContext
- Overrides:
refresh
in class AbstractApplicationContext
- Throws:
BeansException
IllegalStateException
normalRefresh
public void normalRefresh()
- Description copied from interface:
DelegatedExecutionOsgiBundleApplicationContext
- The non-delegated refresh operation.
- Specified by:
normalRefresh
in interface DelegatedExecutionOsgiBundleApplicationContext
- See Also:
ConfigurableApplicationContext.refresh()
normalClose
public void normalClose()
- Description copied from interface:
DelegatedExecutionOsgiBundleApplicationContext
- The non-delegated close operation.
- Specified by:
normalClose
in interface DelegatedExecutionOsgiBundleApplicationContext
- See Also:
ConfigurableApplicationContext.close()
doClose
protected void doClose()
- Description copied from class:
AbstractOsgiBundleApplicationContext
- Unregister the ApplicationContext OSGi service (in case there is any).
- Overrides:
doClose
in class AbstractOsgiBundleApplicationContext
startRefresh
public void startRefresh()
- Description copied from interface:
DelegatedExecutionOsgiBundleApplicationContext
- First phase of the refresh. Executes right a certain condition, imposed
by the executor is checked. Normally, this just prepares the beanFactory
but does not creates any beans.
- Specified by:
startRefresh
in interface DelegatedExecutionOsgiBundleApplicationContext
completeRefresh
public void completeRefresh()
- Description copied from interface:
DelegatedExecutionOsgiBundleApplicationContext
- The second, last phase of the refresh. Finishes the rest of the refresh
operation. Normally, this operations performs most of the refresh work,
such as instantiating singleton.
- Specified by:
completeRefresh
in interface DelegatedExecutionOsgiBundleApplicationContext
finishRefresh
protected void finishRefresh()
- Overrides:
finishRefresh
in class AbstractApplicationContext
getMonitor
public Object getMonitor()
- Description copied from interface:
DelegatedExecutionOsgiBundleApplicationContext
- Synchronization monitor for this
ApplicationContext
in case multiple
threads can work with the application context lifecycle.
- Specified by:
getMonitor
in interface DelegatedExecutionOsgiBundleApplicationContext
- Returns:
- monitor for this application context.
setExecutor
public void setExecutor(OsgiBundleApplicationContextExecutor executor)
- Description copied from interface:
DelegatedExecutionOsgiBundleApplicationContext
- Assign the
OsgiBundleApplicationContextExecutor
for this delegated context.
- Specified by:
setExecutor
in interface DelegatedExecutionOsgiBundleApplicationContext
Copyright © 2006-2007 Spring Framework. All Rights Reserved.