Use spring-integration-zookeeper

- In favour of deprecater spring-cloud-cluster
- Fixe some zookeeper deprecation issues
- Fixes #345
This commit is contained in:
Janne Valkealahti
2017-04-11 20:20:53 +01:00
parent 7cd5f3c069
commit def0fce98c
3 changed files with 10 additions and 11 deletions

View File

@@ -83,7 +83,6 @@ configure(allprojects) {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:Dalston.BUILD-SNAPSHOT"
mavenBom "org.springframework.boot:spring-boot-dependencies:$springBootVersion"
mavenBom "org.springframework.cloud:spring-cloud-cluster-dependencies:$springCloudClusterVersion"
}
dependencies {
dependency "log4j:log4j:$log4jVersion"
@@ -303,7 +302,7 @@ project('spring-statemachine-cluster') {
dependencies {
compile project(":spring-statemachine-zookeeper")
compile "org.springframework.cloud:spring-cloud-cluster-zookeeper"
compile "org.springframework.integration:spring-integration-zookeeper"
testCompile project(":spring-statemachine-test")
testCompile "org.apache.curator:curator-test"

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -19,9 +19,9 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.curator.framework.CuratorFramework;
import org.springframework.cloud.cluster.leader.Context;
import org.springframework.cloud.cluster.leader.DefaultCandidate;
import org.springframework.cloud.cluster.zk.leader.LeaderInitiator;
import org.springframework.integration.leader.Context;
import org.springframework.integration.leader.DefaultCandidate;
import org.springframework.integration.zookeeper.leader.LeaderInitiator;
import org.springframework.statemachine.StateMachine;
import org.springframework.statemachine.ensemble.StateMachineEnsemble;
import org.springframework.statemachine.zookeeper.ZookeeperStateMachineEnsemble;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 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.
@@ -32,10 +32,10 @@ import org.apache.curator.framework.api.transaction.CuratorTransaction;
import org.apache.curator.framework.api.transaction.CuratorTransactionFinal;
import org.apache.curator.framework.imps.CuratorFrameworkState;
import org.apache.curator.framework.recipes.locks.InterProcessSemaphoreMutex;
import org.apache.curator.framework.recipes.nodes.PersistentEphemeralNode;
import org.apache.curator.framework.recipes.nodes.PersistentEphemeralNode.Mode;
import org.apache.curator.framework.recipes.nodes.PersistentNode;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.curator.framework.state.ConnectionStateListener;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.data.Stat;
import org.springframework.statemachine.StateMachine;
@@ -75,7 +75,7 @@ public class ZookeeperStateMachineEnsemble<S, E> extends StateMachineEnsembleObj
private final AtomicReference<StateWrapper> stateRef = new AtomicReference<StateWrapper>();
private final AtomicReference<StateWrapper> notifyRef = new AtomicReference<StateWrapper>();
private final CuratorWatcher watcher = new StateWatcher();
private PersistentEphemeralNode node;
private PersistentNode node;
private final Queue<StateMachine<S, E>> joinQueue = new ConcurrentLinkedQueue<StateMachine<S, E>>();
private final List<StateMachine<S, E>> joined = new ArrayList<StateMachine<S,E>>();
private final Object joinLock = new Object();
@@ -297,7 +297,7 @@ public class ZookeeperStateMachineEnsemble<S, E> extends StateMachineEnsembleObj
}
}
node = new PersistentEphemeralNode(curatorClient, Mode.EPHEMERAL, memberPath + "/" + uuid, new byte[0]);
node = new PersistentNode(curatorClient, CreateMode.EPHEMERAL, true, memberPath + "/" + uuid, new byte[0]);
node.start();
node.waitForInitialCreate(60, TimeUnit.SECONDS);