Add distibuted action

- New module spring-statemachine-cluster which is
  based on spring-cloud-cluster to provide leader
  election.
- Ensemble now has a concept of a leader if implementation
  supports it.
- New DistributedLeaderAction can use leader info to execute
  action only on a leader.
- Tweak web sample with these new concepts.
- Fixes #176
This commit is contained in:
Janne Valkealahti
2016-03-28 10:44:48 +01:00
parent 89d183f91c
commit 6cce27e30b
23 changed files with 951 additions and 123 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -167,6 +167,11 @@ public class ZookeeperStateMachineEnsemble<S, E> extends StateMachineEnsembleObj
}
}
@Override
public StateMachine<S, E> getLeader() {
return null;
}
private void joinQueued() {
StateMachine<S, E> stateMachine = null;
synchronized (joinLock) {

View File

@@ -671,6 +671,14 @@ public class ZookeeperStateMachineEnsembleTests extends AbstractZookeeperTests {
errorLatch.countDown();
}
@Override
public void ensembleLeaderGranted(StateMachine<String, String> stateMachine) {
}
@Override
public void ensembleLeaderRevoked(StateMachine<String, String> stateMachine) {
}
public void reset(int c1, int c2) {
reset(c1, c2, 0);
}