usage_retryPolicies() / usage_retryPoliciesAsync()
usage_configManagement() / usage_watchers()
usage_typedModel() / usage_leaderElection()
usage_sharedLock() / usage_counter()
Running 3 applications
- Client001
$ java -Dlock.client.id=0001 -Dserver.port=8081 -Dspring.profiles.active=master-slave -jar demo.jar
- Client002
$ java -Dlock.client.id=0002 -Dserver.port=8082 -Dspring.profiles.active=master-slave -jar demo.jar
- Client003
$ java -Dlock.client.id=0003 -Dserver.port=8083 -Dspring.profiles.active=master-slave -jar demo.jar
=> If terminate a client having leadership, then another client will have leadership
2018-12-15 01:18:28.578 INFO 5275 --- [eaderSelector-0] demo.master.LeaderListener : [0001] task leadership.... client : org.apache.curator.framework.imps.CuratorFrameworkImpl@79191bc4
2018-12-15 01:18:29.255 INFO 5275 --- [ Thread-2] [MASTER-SLAVE] : [Check leader - 0001] is leader : true