From 97a3a4f07cdc8437f73f4270b237e85c7739a6be Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 27 May 2008 17:23:45 +0000 Subject: client and server variables are now separate in the editor. --- .../implementations/TwoPhaseCommitProtocol.java | 37 +++++++++++----------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'sources/protocols/implementations/TwoPhaseCommitProtocol.java') diff --git a/sources/protocols/implementations/TwoPhaseCommitProtocol.java b/sources/protocols/implementations/TwoPhaseCommitProtocol.java index b7c38f8..cd1a5ce 100644 --- a/sources/protocols/implementations/TwoPhaseCommitProtocol.java +++ b/sources/protocols/implementations/TwoPhaseCommitProtocol.java @@ -30,30 +30,24 @@ public class TwoPhaseCommitProtocol extends VSAbstractProtocol { */ public TwoPhaseCommitProtocol() { setClassname(getClass().toString()); + } - /* Can be changed via GUI variables editor of each process */ + /* (non-Javadoc) + * @see events.VSAbstractProtocol#onClientInit() + */ + public void onClientInit() { Vector vec = new Vector(); vec.add(2); vec.add(3); - /* Server */ initVector("pids", vec, "PIDs beteilitger Prozesse"); initLong("timeout", 2500, "Zeit bis erneuerter Anfrage", "ms"); - - /* Client */ - initInteger("ackProb", 50, "Festschreibw'keit", 0, 100, "%"); - } - - /* (non-Javadoc) - * @see events.VSAbstractEvent#onInit() - */ - protected void onInit() { } /* (non-Javadoc) * @see protocols.VSAbstractProtocol#onClientReset() */ - protected void onClientReset() { + public void onClientReset() { if (votePids != null) { voteResult = true; votePids.clear(); @@ -66,7 +60,7 @@ public class TwoPhaseCommitProtocol extends VSAbstractProtocol { /* (non-Javadoc) * @see protocols.VSAbstractProtocol#onClientStart() */ - protected void onClientStart() { + public void onClientStart() { if (votePids == null) { voteResult = true; votePids = new ArrayList(); @@ -97,7 +91,7 @@ public class TwoPhaseCommitProtocol extends VSAbstractProtocol { /* (non-Javadoc) * @see protocols.VSAbstractProtocol#onClientRecv(core.VSMessage) */ - protected void onClientRecv(VSMessage recvMessage) { + public void onClientRecv(VSMessage recvMessage) { if (votePids.size() != 0 && recvMessage.getBoolean("isVote")) { Integer pid = recvMessage.getIntegerObj("pid"); if (votePids.contains(pid)) @@ -136,7 +130,7 @@ public class TwoPhaseCommitProtocol extends VSAbstractProtocol { /* (non-Javadoc) * @see protocols.VSAbstractProtocol#onClientSchedule() */ - protected void onClientSchedule() { + public void onClientSchedule() { onClientStart(); } @@ -144,17 +138,24 @@ public class TwoPhaseCommitProtocol extends VSAbstractProtocol { private boolean voteSent; private boolean myVote; + /* (non-Javadoc) + * @see events.VSAbstractProtocol#onServerInit() + */ + public void onServerInit() { + initInteger("ackProb", 50, "Festschreibw'keit", 0, 100, "%"); + } + /* (non-Javadoc) * @see protocols.VSAbstractProtocol#onServerReset() */ - protected void onServerReset() { + public void onServerReset() { voteSent = false; } /* (non-Javadoc) * @see protocols.VSAbstractProtocol#onServerRecv(core.VSMessage) */ - protected void onServerRecv(VSMessage recvMessage) { + public void onServerRecv(VSMessage recvMessage) { if (recvMessage.getBoolean("wantVote")) { if (!voteSent) { voteSent = true; @@ -183,6 +184,6 @@ public class TwoPhaseCommitProtocol extends VSAbstractProtocol { /* (non-Javadoc) * @see protocols.VSAbstractProtocol#onServerSchedule() */ - protected void onServerSchedule() { + public void onServerSchedule() { } } -- cgit v1.2.3