stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [15/50] [abbrv] git commit: stopping transitions to self in LifeCycleStateManager
Date Thu, 30 Oct 2014 04:13:39 GMT
stopping transitions to self in LifeCycleStateManager


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/4f6b5fe6
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/4f6b5fe6
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/4f6b5fe6

Branch: refs/heads/docker-grouping-merge
Commit: 4f6b5fe63f01c2767800edfb00c0e48d765c161a
Parents: 2f1b92b
Author: Isuru Haththotuwa <isuruh@apache.org>
Authored: Mon Oct 27 18:48:35 2014 +0530
Committer: Isuru Haththotuwa <isuruh@apache.org>
Committed: Mon Oct 27 18:48:47 2014 +0530

----------------------------------------------------------------------
 .../lifecycle/LifeCycleStateManager.java         | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/4f6b5fe6/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
index f57edf8..db8d5d4 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/lifecycle/LifeCycleStateManager.java
@@ -70,15 +70,22 @@ public class LifeCycleStateManager<T extends LifeCycleState> implements
Serializ
     }
 
     /**
-     * Changes the current state to nextState
+     * Changes the current state to nextState, if nextState is not as same as the current
state
      *
      * @param nextState the next state to change
      */
-    public void changeState (T nextState)  {
-
-        stateStack.push(nextState);
-        log.info("Topology element [ " + identifier + " ]'s life Cycle State changed from
[ " +
-                getPreviousState() + " ] to [ " + getCurrentState() + " ]");
+    public synchronized void changeState (T nextState)  {
+
+        if (getCurrentState() != nextState) {
+            stateStack.push(nextState);
+            log.info("Topology element [ " + identifier + " ]'s life Cycle State changed
from [ " +
+                    getPreviousState() + " ] to [ " + getCurrentState() + " ]");
+        } else {
+            if (log.isDebugEnabled()) {
+                log.debug("Topology element [ " + identifier +" ]'s life Cycle State has
been " +
+                        "already updated to [ " + nextState + " ]");
+            }
+        }
         if (log.isDebugEnabled()) {
             printStateTransitions(stateStack);
         }


Mime
View raw message