usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [42/50] [abbrv] git commit: Setup stack with the latest runnerCount info
Date Mon, 07 Jul 2014 18:16:59 GMT
Setup stack with the latest runnerCount info


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/63915713
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/63915713
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/63915713

Branch: refs/heads/two-dot-o
Commit: 6391571374d3825028c15ced06f7ca4c24c3d194
Parents: 9b6d819
Author: Furkan Bicak <bicak.cs@safehaus.org>
Authored: Mon Jun 30 10:40:07 2014 +0300
Committer: Furkan Bicak <bicak.cs@safehaus.org>
Committed: Mon Jun 30 10:40:07 2014 +0300

----------------------------------------------------------------------
 .../chop/webapp/coordinator/StackCoordinator.java         | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/63915713/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
----------------------------------------------------------------------
diff --git a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
index 58998cf..f0811d3 100644
--- a/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
+++ b/chop/webapp/src/main/java/org/apache/usergrid/chop/webapp/coordinator/StackCoordinator.java
@@ -122,16 +122,20 @@ public class StackCoordinator {
     public CoordinatedStack setupStack( Stack stack, User user, Commit commit, Module module,
int runnerCount ) {
 
         CoordinatedStack coordinatedStack = getCoordinatedStack( stack, user, commit, module
);
-        if ( coordinatedStack != null ) {
+        if ( coordinatedStack != null && coordinatedStack.getRunnerCount() == runnerCount
) {
             LOG.info( "Stack {} is already registered", stack.getName() );
             if( coordinatedStack.getSetupState() == SetupStackState.SetUp ) {
                 return coordinatedStack;
             }
         }
-        else {
-            coordinatedStack = new CoordinatedStack( stack, user, commit, module, runnerCount
);
+        else if ( coordinatedStack != null && coordinatedStack.getRunnerCount() !=
runnerCount  ) {
+            LOG.info( "Stack {} is registered with different runner count, first removing
the old stack", stack.getName() );
+            registeredStacks.remove( coordinatedStack.hashCode() );
         }
 
+        LOG.info( "Registering new stack {}...", stack.getName() );
+        coordinatedStack = new CoordinatedStack( stack, user, commit, module, runnerCount
);
+
         LOG.info( "Starting setup stack thread of {}...", stack.getName() );
         synchronized ( coordinatedStack ) {
             coordinatedStack.setSetupState( SetupStackSignal.SETUP );


Mime
View raw message