servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r752080 - /servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java
Date Tue, 10 Mar 2009 12:17:21 GMT
Author: gnodet
Date: Tue Mar 10 12:17:20 2009
New Revision: 752080

URL: http://svn.apache.org/viewvc?rev=752080&view=rev
Log:
Component state restoration should only be handled the first time

Modified:
    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java

Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java?rev=752080&r1=752079&r2=752080&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java
(original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/artifacts/ComponentImpl.java
Tue Mar 10 12:17:20 2009
@@ -50,6 +50,7 @@
     private javax.jbi.component.Component component;
     private Set<ServiceUnitImpl> serviceUnits;
     private SharedLibrary[] sharedLibraries;
+    private boolean restoreState = true;
 
     public ComponentImpl(Bundle bundle,
                          ComponentDesc componentDesc,
@@ -233,29 +234,31 @@
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
             try {
                 Thread.currentThread().setContextClassLoader(component.getClass().getClassLoader());
-                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:
-                        fireEvent(LifeCycleEvent.LifeCycleEventType.ShuttingDown);
-                        lifeCycle.init(contextToUse);
-                        state = State.Shutdown;
-                        fireEvent(LifeCycleEvent.LifeCycleEventType.ShutDown);
-                        break;
+                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);



Mime
View raw message