Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.gemini.blueprint.extender.internal.dependencies.startup
Class DependencyWaiterApplicationContextExecutor

    java.lang.Object
      org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor

All Implemented Interfaces:
  OsgiBundleApplicationContextExecutor, ContextExecutorAccessor

    public class DependencyWaiterApplicationContextExecutor

extends Object
implements OsgiBundleApplicationContextExecutor, ContextExecutorAccessor

Dependency waiter executor that breaks the 'traditional' `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.

Author:
  Hal Hildebrand, Costin Leau

Field Summary
`protected DelegatedExecutionOsgiBundleApplicationContext` | `delegateContext`
`protected DependencyServiceManager` | `dependencyDetector` OSGi service dependencyDetector used for detecting dependencies

Constructor Summary
`DependencyWaiterApplicationContextExecutor(DelegatedExecutionOsgiBundleApplicationContext delegateContext, boolean syncWait, List<OsgiServiceDependencyFactory> dependencyFactories)`

Method Summary
`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()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### dependencyDetector

    protected DependencyServiceManager dependencyDetector

  OSGi service dependencyDetector used for detecting dependencies

### delegateContext

    protected final DelegatedExecutionOsgiBundleApplicationContext delegateContext

Constructor Detail

### DependencyWaiterApplicationContextExecutor

    public DependencyWaiterApplicationContextExecutor(DelegatedExecutionOsgiBundleApplicationContext delegateContext,
                                                      boolean syncWait,
                                                      List<OsgiServiceDependencyFactory> dependencyFactories)

Method Detail

### refresh

    public void refresh()
                 throws org.springframework.beans.BeansException,
                        IllegalStateException

  Provide a continuation like approach to the application context. Will execute just some parts of refresh and then leave the rest of to be executed after a number of conditions have been met.

  Specified by:
    `refresh` in interface `OsgiBundleApplicationContextExecutor`
  Throws:
    `org.springframework.beans.BeansException`
    `IllegalStateException`

### init

    protected void init()

  Do some sanity checks

### stageOne

    protected void stageOne()

  Start the first stage of the application context refresh. Determines the service dependencies and if there are any, registers a OSGi service dependencyDetector which will continue the refresh process asynchronously.

  Based on the `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.

### stageTwo

    protected void stageTwo()

### close

    public void close()

  The application context is being shutdown. Deregister the listener and prevent classes from being loaded since it's Doom's day.

  Specified by:
    `close` in interface `OsgiBundleApplicationContextExecutor`

### fail

    public void fail(Throwable t)

  Specified by:
    `fail` in interface `ContextExecutorAccessor`

### createDependencyServiceListener

    protected DependencyServiceManager createDependencyServiceListener(Runnable task)

### startWatchDog

    protected void startWatchDog()

  Schedule the watchdog task.

### stopWatchDog

    protected void stopWatchDog()

### setTimeout

    public void setTimeout(long timeout)

  Sets the timeout (in ms) for waiting for service dependencies.

  Parameters:
    `timeout` -

### setTaskExecutor

    public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExec)

### setWatchdog

    public void setWatchdog(Timer watchdog)

### setMonitoringCounter

    public void setMonitoringCounter(Counter contextsStarted)

  Pass in the context counter. Used by the listener to track the number of contexts started.

  Parameters:
    `asynchCounter` -

### setDelegatedMulticaster

    public void setDelegatedMulticaster(OsgiBundleApplicationContextEventMulticaster multicaster)

  Sets the multicaster for delegating failing events.

  Parameters:
    `multicaster` -

### getContextState

    public ContextState getContextState()

  Specified by:
    `getContextState` in interface `ContextExecutorAccessor`

### getEventMulticaster

    public OsgiBundleApplicationContextEventMulticaster getEventMulticaster()

  Specified by:
    `getEventMulticaster` in interface `ContextExecutorAccessor`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013. All Rights Reserved.