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
chooses how to call the lifecycle methods.
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, the refresh method in executed 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
- Non-delegated refresh operation (execute
ConfigurableApplicationContext.refresh()
in the
traditional way).
- Specified by:
normalRefresh
in interface DelegatedExecutionOsgiBundleApplicationContext
- See Also:
ConfigurableApplicationContext.refresh()
normalClose
public void normalClose()
- Description copied from interface:
DelegatedExecutionOsgiBundleApplicationContext
- Non-delegated close operation (execute
ConfigurableApplicationContext.close()
in the
traditional way).
- 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. Normally, this just prepares the
beanFactory
but does not instantiates any beans.
- Specified by:
startRefresh
in interface DelegatedExecutionOsgiBundleApplicationContext
completeRefresh
public void completeRefresh()
- Description copied from interface:
DelegatedExecutionOsgiBundleApplicationContext
- The second, last phase of the refresh. Executes after a certain
condition, imposed by the executor, has been met. Finishes the rest of
the
refresh
operation. Normally, this operations performs
most of the refresh work
, such as instantiating
singletons.
- 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
- Assigns the
OsgiBundleApplicationContextExecutor
for this
delegated context.
- Specified by:
setExecutor
in interface DelegatedExecutionOsgiBundleApplicationContext
- Parameters:
executor
- the executor of this application context, to which the
refresh
method is delegated to
Copyright © 2006-2008 Spring Framework. All Rights Reserved.