From cf885a53faea37e1d8daf35f7553128cc4685b7d Mon Sep 17 00:00:00 2001 From: "Frank.R.Wu" Date: Fri, 26 Nov 2021 15:54:35 +0800 Subject: [PATCH] fix: fix bugs in event mechanism fix bugs in event delivering cross nodes --- src/main/java/org/bdware/sc/ContractManager.java | 2 +- src/main/java/org/bdware/sc/handler/ManagerHandler.java | 2 +- src/main/java/org/bdware/sc/sequencing/CommitAlgorithm.java | 2 ++ .../org/bdware/sc/units/TrustfulExecutorConnection.java | 6 +++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/bdware/sc/ContractManager.java b/src/main/java/org/bdware/sc/ContractManager.java index 53de50c..6a09641 100644 --- a/src/main/java/org/bdware/sc/ContractManager.java +++ b/src/main/java/org/bdware/sc/ContractManager.java @@ -1877,7 +1877,7 @@ public class ContractManager { return ret; } - public String deliverEMessage(REvent msg) { + public String deliverEvent(REvent msg) { eventBroker.handle(msg); return "success"; } diff --git a/src/main/java/org/bdware/sc/handler/ManagerHandler.java b/src/main/java/org/bdware/sc/handler/ManagerHandler.java index 52236ad..35309dd 100644 --- a/src/main/java/org/bdware/sc/handler/ManagerHandler.java +++ b/src/main/java/org/bdware/sc/handler/ManagerHandler.java @@ -96,6 +96,6 @@ public class ManagerHandler extends MsgHandler { @Description("Deliver event message") public void deliverEMessage(GetMessage msg, ResultCallback cb) { REvent eMsg = JsonUtil.fromJson(msg.arg, REvent.class); - cb.onResult(cm.deliverEMessage(eMsg)); + cb.onResult(cm.deliverEvent(eMsg)); } } diff --git a/src/main/java/org/bdware/sc/sequencing/CommitAlgorithm.java b/src/main/java/org/bdware/sc/sequencing/CommitAlgorithm.java index ce74d85..8e2049b 100644 --- a/src/main/java/org/bdware/sc/sequencing/CommitAlgorithm.java +++ b/src/main/java/org/bdware/sc/sequencing/CommitAlgorithm.java @@ -5,6 +5,8 @@ import org.bdware.sc.units.TrustfulExecutorConnection; public interface CommitAlgorithm { void onMessage(Node node, byte[] msg); + void setCommitter(Committer c); + void setConnection(TrustfulExecutorConnection c); } \ No newline at end of file diff --git a/src/main/java/org/bdware/sc/units/TrustfulExecutorConnection.java b/src/main/java/org/bdware/sc/units/TrustfulExecutorConnection.java index 7c03337..13660fa 100644 --- a/src/main/java/org/bdware/sc/units/TrustfulExecutorConnection.java +++ b/src/main/java/org/bdware/sc/units/TrustfulExecutorConnection.java @@ -5,12 +5,12 @@ import org.bdware.sc.conn.Node; import java.util.List; public interface TrustfulExecutorConnection { - public void sendMessage(T node, byte[] msg); + void sendMessage(T node, byte[] msg); - default public void broadcast(byte[] msg) { + default void broadcast(byte[] msg) { for (T t : getNodes()) sendMessage(t, msg); } - public List getNodes(); + List getNodes(); } \ No newline at end of file