diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-27 20:13:54 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-27 20:13:54 +0000 |
| commit | 23055ca47090021dbf84d05d5e14c8990479bfe1 (patch) | |
| tree | 36edcf38df1569abb3f81f92cf6b6acc1689b714 /sources/protocols/implementations/OnePhaseCommitProtocol.java | |
| parent | fae58d2173039e70ad94075d49c0c500e935e454 (diff) | |
onServerStart vs onClientStart works.
Diffstat (limited to 'sources/protocols/implementations/OnePhaseCommitProtocol.java')
| -rw-r--r-- | sources/protocols/implementations/OnePhaseCommitProtocol.java | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/sources/protocols/implementations/OnePhaseCommitProtocol.java b/sources/protocols/implementations/OnePhaseCommitProtocol.java index 53c8ce6..fcb5499 100644 --- a/sources/protocols/implementations/OnePhaseCommitProtocol.java +++ b/sources/protocols/implementations/OnePhaseCommitProtocol.java @@ -16,23 +16,24 @@ import core.VSMessage; public class OnePhaseCommitProtocol extends VSAbstractProtocol { private static final long serialVersionUID = 1L; - /* Server variables, coordinator */ + /* Client variables, coordinator */ private ArrayList<Integer> pids; - /* Client variables */ + /* Server variables */ private boolean ackSent; /** * Instantiates a one phase commit protocol. */ public OnePhaseCommitProtocol() { + super(VSAbstractProtocol.HAS_ON_SERVER_START); setClassname(getClass().toString()); } /* (non-Javadoc) - * @see events.VSAbstractProtocol#onClientInit() + * @see events.VSAbstractProtocol#onServerInit() */ - public void onClientInit() { + public void onServerInit() { /* Can be changed via GUI variables editor of each process */ Vector<Integer> vec = new Vector<Integer>(); vec.add(2); @@ -43,9 +44,9 @@ public class OnePhaseCommitProtocol extends VSAbstractProtocol { } /* (non-Javadoc) - * @see protocols.VSAbstractProtocol#onClientReset() + * @see protocols.VSAbstractProtocol#onServerReset() */ - public void onClientReset() { + public void onServerReset() { if (pids != null) { pids.clear(); pids.addAll(getVector("pids")); @@ -53,9 +54,9 @@ public class OnePhaseCommitProtocol extends VSAbstractProtocol { } /* (non-Javadoc) - * @see protocols.VSAbstractProtocol#onClientStart() + * @see protocols.VSAbstractProtocol#onServerStart() */ - public void onClientStart() { + public void onServerStart() { if (pids == null) { pids = new ArrayList<Integer>(); pids.addAll(getVector("pids")); @@ -63,7 +64,7 @@ public class OnePhaseCommitProtocol extends VSAbstractProtocol { if (pids.size() != 0) { long timeout = getLong("timeout") + process.getTime(); - scheduleAt(timeout); /* Will run onClientSchedule() at the specified local time */ + scheduleAt(timeout); /* Will run onServerSchedule() at the specified local time */ VSMessage message = new VSMessage(); message.setBoolean("wantAck", true); @@ -72,9 +73,9 @@ public class OnePhaseCommitProtocol extends VSAbstractProtocol { } /* (non-Javadoc) - * @see protocols.VSAbstractProtocol#onClientRecv(core.VSMessage) + * @see protocols.VSAbstractProtocol#onServerRecv(core.VSMessage) */ - public void onClientRecv(VSMessage recvMessage) { + public void onServerRecv(VSMessage recvMessage) { if (pids.size() == 0) return; @@ -93,29 +94,29 @@ public class OnePhaseCommitProtocol extends VSAbstractProtocol { } /* (non-Javadoc) - * @see protocols.VSAbstractProtocol#onClientSchedule() + * @see protocols.VSAbstractProtocol#onServerSchedule() */ - public void onClientSchedule() { - onClientStart(); + public void onServerSchedule() { + onServerStart(); } /* (non-Javadoc) - * @see events.VSAbstractProtocol#onServerInit() + * @see events.VSAbstractProtocol#onClientInit() */ - public void onServerInit() { + public void onClientInit() { } /* (non-Javadoc) - * @see protocols.VSAbstractProtocol#onServerReset() + * @see protocols.VSAbstractProtocol#onClientReset() */ - public void onServerReset() { + public void onClientReset() { ackSent = false; } /* (non-Javadoc) - * @see protocols.VSAbstractProtocol#onServerRecv(core.VSMessage) + * @see protocols.VSAbstractProtocol#onClientRecv(core.VSMessage) */ - public void onServerRecv(VSMessage recvMessage) { + public void onClientRecv(VSMessage recvMessage) { if (ackSent) return; @@ -128,9 +129,9 @@ public class OnePhaseCommitProtocol extends VSAbstractProtocol { } /* (non-Javadoc) - * @see protocols.VSAbstractProtocol#onServerSchedule() + * @see protocols.VSAbstractProtocol#onClientSchedule() */ - public void onServerSchedule() { + public void onClientSchedule() { } /* (non-Javadoc) |
