diff --git a/src/main/java/com/yuandian/dataflow/controller/PacketsProcessor.java b/src/main/java/com/yuandian/dataflow/controller/PacketsProcessor.java index b215770..5425866 100644 --- a/src/main/java/com/yuandian/dataflow/controller/PacketsProcessor.java +++ b/src/main/java/com/yuandian/dataflow/controller/PacketsProcessor.java @@ -9,6 +9,8 @@ package com.yuandian.dataflow.controller; import java.io.Serializable; import java.time.Instant; import java.util.ArrayList; +import java.util.Random; +import java.util.concurrent.ThreadLocalRandom; import com.alipay.sofa.jraft.Status; import com.alipay.sofa.jraft.rpc.RpcContext; @@ -43,6 +45,8 @@ public class PacketsProcessor implements RpcProcessor packets = new ArrayList<>(); } + public static Random rand = new Random(); + @Override public void handleRequest(RpcContext rpcCtx, PacketsRequest request) { // StateServerFactory.getStateServer().updateFsmStateAsync(s, onCompleted); @@ -54,8 +58,11 @@ public class PacketsProcessor implements RpcProcessor 里的 getValue为 State的状态 diff --git a/src/main/java/com/yuandian/dataflow/statemachine/MasterFactory.java b/src/main/java/com/yuandian/dataflow/statemachine/MasterFactory.java index d27358e..ad000ff 100644 --- a/src/main/java/com/yuandian/dataflow/statemachine/MasterFactory.java +++ b/src/main/java/com/yuandian/dataflow/statemachine/MasterFactory.java @@ -122,7 +122,7 @@ public class MasterFactory { }); } - Thread.sleep(5000); + Thread.sleep(2000); } } catch (InterruptedException e) { log.info("{}", e.toString());