From 6f13f269174945c0d3100bb4f6accb3fcc3c3b4f Mon Sep 17 00:00:00 2001 From: shaozhuguang Date: Tue, 2 Jul 2019 14:01:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BFTSMART=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E5=85=B3=E8=81=94=E7=BD=91=E5=8D=A1=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../consensus/bftsmart/service/BftsmartNodeServer.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java b/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java index 162ff130..7b7dcdf5 100644 --- a/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java +++ b/source/consensus/consensus-bftsmart/src/main/java/com/jd/blockchain/consensus/bftsmart/service/BftsmartNodeServer.java @@ -6,6 +6,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import bftsmart.tom.*; +import com.jd.blockchain.utils.serialize.binary.BinarySerializeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.jd.blockchain.consensus.ConsensusManageService; @@ -49,12 +50,12 @@ public class BftsmartNodeServer extends DefaultRecoverable implements NodeServer private BftsmartConsensusManageService manageService; - private volatile BftsmartTopology topology; private volatile BftsmartConsensusSettings setting; private TOMConfiguration tomConfig; + private TOMConfiguration outerTomConfig; private HostsConfig hostsConfig; private Properties systemConfig; @@ -123,14 +124,11 @@ public class BftsmartNodeServer extends DefaultRecoverable implements NodeServer return; } - protected void initConfig(int id, String systemConfig, String hostsConfig) { - - this.tomConfig = new TOMConfiguration(id, systemConfig, hostsConfig); - - } - protected void initConfig(int id, Properties systemsConfig, HostsConfig hostConfig) { + byte[] serialHostConf = BinarySerializeUtils.serialize(hostConfig); + Properties sysConfClone = (Properties)systemsConfig.clone(); this.tomConfig = new TOMConfiguration(id, systemsConfig, hostConfig); + this.outerTomConfig = new TOMConfiguration(id, sysConfClone, BinarySerializeUtils.deserialize(serialHostConf)); } @Override @@ -149,7 +147,7 @@ public class BftsmartNodeServer extends DefaultRecoverable implements NodeServer } public TOMConfiguration getTomConfig() { - return tomConfig; + return outerTomConfig; } public int getId() { @@ -161,7 +159,7 @@ public class BftsmartNodeServer extends DefaultRecoverable implements NodeServer throw new IllegalArgumentException("ReplicaID is negative!"); } this.tomConfig.setProcessId(id); - + this.outerTomConfig.setProcessId(id); } public BftsmartConsensusSettings getConsensusSetting() {