in jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java [231:271]
public void init(ComponentContext context) throws JBIException {
ComponentContext contextToUse = context;
if (this.context == null) {
this.context = context;
}
if (contextToUse == null) {
contextToUse = this.context;
}
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getComponentClassLoader());
if (restoreState) {
State stateToUse = context != null ? runningState : State.Shutdown;
switch (stateToUse) {
case Started:
fireEvent(LifeCycleEvent.LifeCycleEventType.Starting);
lifeCycle.init(contextToUse);
start();
state = State.Started;
fireEvent(LifeCycleEvent.LifeCycleEventType.Started);
break;
case Stopped:
fireEvent(LifeCycleEvent.LifeCycleEventType.Stopping);
lifeCycle.init(contextToUse);
start();
stop();
state = State.Stopped;
fireEvent(LifeCycleEvent.LifeCycleEventType.Stopped);
break;
case Shutdown:
state = State.Shutdown;
break;
}
restoreState = false;
} else {
lifeCycle.init(contextToUse);
}
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
}