summaryrefslogtreecommitdiff
path: root/sources/protocols/implementations
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-30 11:32:20 +0000
committerPaul Buetow <paul@buetow.org>2008-05-30 11:32:20 +0000
commit1e54f3932963a67894ccc9c80155c9e1ff461148 (patch)
tree7e2928f646263b9ce1b85bb20caf2840a029feab /sources/protocols/implementations
parent39f85a54cc522fb9d0f0196dc2f4577fffc9b897 (diff)
documented more.
Diffstat (limited to 'sources/protocols/implementations')
-rw-r--r--sources/protocols/implementations/2DOCUMENT0
-rw-r--r--sources/protocols/implementations/VSBasicMulticastProtocol.java21
-rw-r--r--sources/protocols/implementations/VSBerkelyTimeProtocol.java37
-rw-r--r--sources/protocols/implementations/VSBroadcastSturmProtocol.java25
-rw-r--r--sources/protocols/implementations/VSDummyProtocol.java22
-rw-r--r--sources/protocols/implementations/VSExternalTimeSyncProtocol.java31
-rw-r--r--sources/protocols/implementations/VSInternalTimeSyncProtocol.java35
-rw-r--r--sources/protocols/implementations/VSOnePhaseCommitProtocol.java33
-rw-r--r--sources/protocols/implementations/VSPingPongProtocol.java20
-rw-r--r--sources/protocols/implementations/VSReliableMulticastProtocol.java21
-rw-r--r--sources/protocols/implementations/VSTwoPhaseCommitProtocol.java49
11 files changed, 175 insertions, 119 deletions
diff --git a/sources/protocols/implementations/2DOCUMENT b/sources/protocols/implementations/2DOCUMENT
deleted file mode 100644
index e69de29..0000000
--- a/sources/protocols/implementations/2DOCUMENT
+++ /dev/null
diff --git a/sources/protocols/implementations/VSBasicMulticastProtocol.java b/sources/protocols/implementations/VSBasicMulticastProtocol.java
index 8350084..6b12849 100644
--- a/sources/protocols/implementations/VSBasicMulticastProtocol.java
+++ b/sources/protocols/implementations/VSBasicMulticastProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -27,14 +27,17 @@ import protocols.VSAbstractProtocol;
import core.VSMessage;
/**
- * The class VSBasicMulticastProtocol.
+ * The class VSBasicMulticastProtocol, an implementation of the basic multicast
+ * protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSBasicMulticastProtocol extends VSAbstractProtocol {
/** The serial version uid */
private static final long serialVersionUID = 1L;
/**
- * Instantiates a new dummy protocol.
+ * Instantiates a new VSBasicMulticast object.
*/
public VSBasicMulticastProtocol() {
super(VSAbstractProtocol.HAS_ON_CLIENT_START);
diff --git a/sources/protocols/implementations/VSBerkelyTimeProtocol.java b/sources/protocols/implementations/VSBerkelyTimeProtocol.java
index db68351..3792e02 100644
--- a/sources/protocols/implementations/VSBerkelyTimeProtocol.java
+++ b/sources/protocols/implementations/VSBerkelyTimeProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -31,7 +31,10 @@ import java.util.HashMap;
import java.util.Vector;
/**
- * The class VSBerkelyTimeProtocol.
+ * The class VSBerkelyTimeProtocol, an implementation of the berkely time
+ * protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSBerkelyTimeProtocol extends VSAbstractProtocol {
private static final long serialVersionUID = 1L;
@@ -47,13 +50,17 @@ public class VSBerkelyTimeProtocol extends VSAbstractProtocol {
/** Integer: Process ID, Long: Local time of the process */
private HashMap<Integer,Long> processTimes = new HashMap<Integer,Long>();
- /** Integer: Process ID, Long: Time of receiving the response from the process */
+ /** Integer: Process ID, Long: Time of receiving the response from the
+ * process
+ */
private HashMap<Integer,Long> recvTimes = new HashMap<Integer,Long>();
/** Integer: Process ID, Long: Calculated process times (using the RTT) */
private HashMap<Integer,Long> realTimesRTT = new HashMap<Integer,Long>();
- /** Contains all process IDs of processes which want to justify their time */
+ /** Contains all process IDs of processes which want to justify their
+ * time
+ */
private ArrayList<Integer> peers = new ArrayList<Integer>();
/** Time the request/response has started */
@@ -63,7 +70,6 @@ public class VSBerkelyTimeProtocol extends VSAbstractProtocol {
* @see events.VSAbstractProtocol#onServerInit()
*/
public void onServerInit() {
- /* Those prefs are editable through the VSAbstractProtocol VSAbstractEditor GUI. */
Vector<Integer> vec = new Vector<Integer>();
vec.add(2);
vec.add(3);
@@ -96,7 +102,8 @@ public class VSBerkelyTimeProtocol extends VSAbstractProtocol {
* @see protocols.VSAbstractProtocol#onServerRecv(core.VSMessage)
*/
public void onServerRecv(VSMessage recvMessage) {
- /* Ignore all protocol messages which are not a response message, e.g. itself */
+ /* Ignore all protocol messages which are not a response message,
+ e.g. itself */
if (!recvMessage.getBoolean("isResponse"))
return;
@@ -117,7 +124,8 @@ public class VSBerkelyTimeProtocol extends VSAbstractProtocol {
long avgTime = calculateAverageTime();
/* Set the local's process time to the new avg reference time */
process.setTime(avgTime);
- /* Tell all other processes what to do in order to justify their times */
+ /* Tell all other processes what to do in order to justify their
+ times */
sendJustifyRequests(avgTime);
/* Start "clean" next time */
onServerReset();
@@ -192,7 +200,8 @@ public class VSBerkelyTimeProtocol extends VSAbstractProtocol {
} else if (recvMessage.getBoolean("isJustify")) {
/* Check if it's "my" justify message */
- if (recvMessage.getInteger("receiverProcessID") != process.getProcessID())
+ if (recvMessage.getInteger("receiverProcessID") !=
+ process.getProcessID())
return;
long timeDiff = recvMessage.getLong("timeDiff");
diff --git a/sources/protocols/implementations/VSBroadcastSturmProtocol.java b/sources/protocols/implementations/VSBroadcastSturmProtocol.java
index b07f6fb..fda052d 100644
--- a/sources/protocols/implementations/VSBroadcastSturmProtocol.java
+++ b/sources/protocols/implementations/VSBroadcastSturmProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -28,11 +28,14 @@ import java.util.ArrayList;
import core.VSMessage;
import protocols.VSAbstractProtocol;
-// TODO: Auto-generated Javadoc
/**
- * The class VSBroadcastSturmProtocol.
+ * The class VSBroadcastSturmProtocol, an implementation of the broadcast
+ * sturm protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSBroadcastSturmProtocol extends VSAbstractProtocol {
+ /** The serial version uid */
private static final long serialVersionUID = 1L;
/** The sent messages. */
@@ -110,8 +113,8 @@ public class VSBroadcastSturmProtocol extends VSAbstractProtocol {
public void onServerRecv(VSMessage recvMessage) {
if (!sentMessages.contains(recvMessage)) {
VSMessage message = new VSMessage();
- message.setInteger("Broadcast", recvMessage.getInteger("Broadcast"));
-
+ message.setInteger("Broadcast",
+ recvMessage.getInteger("Broadcast"));
sentMessages.add(message);
sendMessage(message);
}
diff --git a/sources/protocols/implementations/VSDummyProtocol.java b/sources/protocols/implementations/VSDummyProtocol.java
index b6fc68f..86b461d 100644
--- a/sources/protocols/implementations/VSDummyProtocol.java
+++ b/sources/protocols/implementations/VSDummyProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -27,13 +27,17 @@ import protocols.VSAbstractProtocol;
import core.VSMessage;
/**
- * The class VSDummyProtocol.
+ * The class VSDummyProtocol, can be used as a template in order to create
+ * own protocols.
+ *
+ * @author Paul C. Buetow
*/
public class VSDummyProtocol extends VSAbstractProtocol {
+ /** The serial version uid */
private static final long serialVersionUID = 1L;
/**
- * Instantiates a new dummy protocol.
+ * Instantiates a new dummy protocol object.
*/
public VSDummyProtocol() {
super(VSAbstractProtocol.HAS_ON_CLIENT_START);
diff --git a/sources/protocols/implementations/VSExternalTimeSyncProtocol.java b/sources/protocols/implementations/VSExternalTimeSyncProtocol.java
index 5f83dcc..d8b792f 100644
--- a/sources/protocols/implementations/VSExternalTimeSyncProtocol.java
+++ b/sources/protocols/implementations/VSExternalTimeSyncProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -26,21 +26,24 @@ package protocols.implementations;
import core.VSMessage;
import protocols.VSAbstractProtocol;
-// TODO: Auto-generated Javadoc
/**
- * The class VSExternalTimeSyncProtocol.
+ * The class VSExternalTimeSyncProtocol, an implementation of the external
+ * time synchronisation protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSExternalTimeSyncProtocol extends VSAbstractProtocol {
+ /** The serial version uid */
private static final long serialVersionUID = 1L;
/** The request time. */
private long requestTime;
- /** The waiting for response. */
+ /** The server is waiting for response, if true. */
private boolean waitingForResponse;
/**
- * Instantiates a new external time sync protocol.
+ * Instantiates a new external time sync protocol object.
*/
public VSExternalTimeSyncProtocol() {
super(VSAbstractProtocol.HAS_ON_CLIENT_START);
@@ -89,7 +92,9 @@ public class VSExternalTimeSyncProtocol extends VSAbstractProtocol {
long serverTime = recvMessage.getLong("time");
long newTime = serverTime + (long) (roundTripTime / 2);
- logg("Server Zeit: " + serverTime + "; RTT: " + roundTripTime + "; Alte Zeit: " + recvTime + "; Neue Zeit: " + newTime + "; Offset: " + (newTime - recvTime));
+ logg("Server Zeit: " + serverTime + "; RTT: " + roundTripTime +
+ "; Alte Zeit: " + recvTime + "; Neue Zeit: " + newTime +
+ "; Offset: " + (newTime - recvTime));
process.setTime(newTime);
}
@@ -135,6 +140,6 @@ public class VSExternalTimeSyncProtocol extends VSAbstractProtocol {
* @see protocols.VSAbstractProtocol#toString()
*/
public String toString() {
- return super.toString(); //+ "; " + prefs.getString("lang.requesttime") + ": " + requestTime;
+ return super.toString();
}
}
diff --git a/sources/protocols/implementations/VSInternalTimeSyncProtocol.java b/sources/protocols/implementations/VSInternalTimeSyncProtocol.java
index 78ec5a3..21eda4a 100644
--- a/sources/protocols/implementations/VSInternalTimeSyncProtocol.java
+++ b/sources/protocols/implementations/VSInternalTimeSyncProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -26,11 +26,14 @@ package protocols.implementations;
import core.VSMessage;
import protocols.VSAbstractProtocol;
-// TODO: Auto-generated Javadoc
/**
- * The class VSInternalTimeSyncProtocol.
+ * The class VSInternalTimeSyncProtocol, an implementation of the internal
+ * time synchronisation protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSInternalTimeSyncProtocol extends VSAbstractProtocol {
+ /** The serial version uid */
private static final long serialVersionUID = 1L;
/** The waiting for response. */
@@ -48,7 +51,6 @@ public class VSInternalTimeSyncProtocol extends VSAbstractProtocol {
* @see events.VSAbstractProtocol#onClientInit()
*/
public void onClientInit() {
- /* Those prefs are editable through the VSAbstractProtocol VSAbstractEditor GUI. t_min and t_max in milliseconds */
initLong("t_min", 2000, "Max. Übetragungszeit", "ms");
initLong("t_max", 500, "Min. Übertragungszeit", "ms");
}
@@ -75,7 +77,8 @@ public class VSInternalTimeSyncProtocol extends VSAbstractProtocol {
* @see protocols.VSAbstractProtocol#onClientRecv(core.VSMessage)
*/
public void onClientRecv(VSMessage recvMessage) {
- /* Ignore all protocol messages which are not a response message, e.g. itself */
+ /* Ignore all protocol messages which are not a response message,
+ e.g. itself */
if (!recvMessage.getBoolean("isServerResponse"))
return;
@@ -89,9 +92,10 @@ public class VSInternalTimeSyncProtocol extends VSAbstractProtocol {
long serverTime = recvMessage.getLong("time");
long newTime = serverTime + (long) ((tMax + tMin) / 2 );
- logg("Server Zeit: " + serverTime + "; (t_min,t_max): (" + tMin + "," + tMax
- + "); Alte Zeit: " + process.getTime() + "; Neue Zeit: " + newTime
- + "; Offset: " + (process.getTime() - newTime));
+ logg("Server Zeit: " + serverTime + "; (t_min,t_max): (" + tMin +
+ "," + tMax + "); Alte Zeit: " + process.getTime() +
+ "; Neue Zeit: " + newTime + "; Offset: " +
+ (process.getTime() - newTime));
process.setTime(newTime);
}
@@ -118,7 +122,8 @@ public class VSInternalTimeSyncProtocol extends VSAbstractProtocol {
* @see protocols.VSAbstractProtocol#onServerRecv(core.VSMessage)
*/
public void onServerRecv(VSMessage recvMessage) {
- /* Ignore all protocol messages which are not a request message, e.g. itself */
+ /* Ignore all protocol messages which are not a request message,
+ e.g. itself */
if (!recvMessage.getBoolean("isClientRequest"))
return;
diff --git a/sources/protocols/implementations/VSOnePhaseCommitProtocol.java b/sources/protocols/implementations/VSOnePhaseCommitProtocol.java
index ab888cb..18c20a5 100644
--- a/sources/protocols/implementations/VSOnePhaseCommitProtocol.java
+++ b/sources/protocols/implementations/VSOnePhaseCommitProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -30,14 +30,15 @@ import protocols.VSAbstractProtocol;
import core.VSMessage;
/**
- * The class VSOnePhaseCommitProtocol.
+ * The class VSOnePhaseCommitProtocol, an implementation of the one phase
+ * commit protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSOnePhaseCommitProtocol extends VSAbstractProtocol {
+ /** The serial version uid */
private static final long serialVersionUID = 1L;
- /* Client variables, coordinator */
- private ArrayList<Integer> pids;
-
/* Server variables */
private boolean ackSent;
@@ -83,7 +84,8 @@ public class VSOnePhaseCommitProtocol extends VSAbstractProtocol {
if (pids.size() != 0) {
long timeout = getLong("timeout") + process.getTime();
- scheduleAt(timeout); /* Will run onServerSchedule() at the specified local time */
+ /* Will run onServerSchedule() at the specified local time */
+ scheduleAt(timeout);
VSMessage message = new VSMessage();
message.setBoolean("wantAck", true);
@@ -108,7 +110,8 @@ public class VSOnePhaseCommitProtocol extends VSAbstractProtocol {
logg("ACK von Prozess " + pid + " erhalten!");
if (pids.size() == 0)
- logg("ACKs von allen beteiligten Prozessen erhalten! Festgeschrieben!");
+ logg("ACKs von allen beteiligten Prozessen erhalten! " +
+ "Festgeschrieben!");
}
}
@@ -119,6 +122,10 @@ public class VSOnePhaseCommitProtocol extends VSAbstractProtocol {
onServerStart();
}
+
+ /* Client variables, coordinator */
+ private ArrayList<Integer> pids;
+
/* (non-Javadoc)
* @see events.VSAbstractProtocol#onClientInit()
*/
diff --git a/sources/protocols/implementations/VSPingPongProtocol.java b/sources/protocols/implementations/VSPingPongProtocol.java
index 9180754..288e836 100644
--- a/sources/protocols/implementations/VSPingPongProtocol.java
+++ b/sources/protocols/implementations/VSPingPongProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -26,11 +26,13 @@ package protocols.implementations;
import core.VSMessage;
import protocols.VSAbstractProtocol;
-// TODO: Auto-generated Javadoc
/**
- * The class VSPingPongProtocol.
+ * The class VSPingPongProtocol, an implementation of the ping pong protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSPingPongProtocol extends VSAbstractProtocol {
+ /** The serial version uid */
private static final long serialVersionUID = 1L;
/** The client counter. */
diff --git a/sources/protocols/implementations/VSReliableMulticastProtocol.java b/sources/protocols/implementations/VSReliableMulticastProtocol.java
index a6ab46b..7e41d8a 100644
--- a/sources/protocols/implementations/VSReliableMulticastProtocol.java
+++ b/sources/protocols/implementations/VSReliableMulticastProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -27,14 +27,17 @@ import protocols.VSAbstractProtocol;
import core.VSMessage;
/**
- * The class VSReliableMulticastProtocol.
+ * The class VSReliableMulticastProtocol, an implementation of the reliable
+ * multicast protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSReliableMulticastProtocol extends VSAbstractProtocol {
/** The serial version uid */
private static final long serialVersionUID = 1L;
/**
- * Instantiates a new dummy protocol.
+ * Instantiates a new reliable multicast protocol object.
*/
public VSReliableMulticastProtocol() {
super(VSAbstractProtocol.HAS_ON_CLIENT_START);
diff --git a/sources/protocols/implementations/VSTwoPhaseCommitProtocol.java b/sources/protocols/implementations/VSTwoPhaseCommitProtocol.java
index 359dbff..67edfca 100644
--- a/sources/protocols/implementations/VSTwoPhaseCommitProtocol.java
+++ b/sources/protocols/implementations/VSTwoPhaseCommitProtocol.java
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2008 Paul C. Buetow, vs@dev.buetow.org
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * All icons of the icons/ folder are under a Creative Commons
- * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
- *
+ *
+ * All icons of the icons/ folder are under a Creative Commons
+ * Attribution-Noncommercial-Share Alike License a CC-by-nc-sa.
+ *
* The icon's homepage is http://code.google.com/p/ultimate-gnome/
*/
@@ -30,13 +30,17 @@ import protocols.VSAbstractProtocol;
import core.VSMessage;
/**
- * The class VSTwoPhaseCommitProtocol.
+ * The class VSTwoPhaseCommitProtocol, an implementation of the two phase
+ * commit protocol.
+ *
+ * @author Paul C. Buetow
*/
public class VSTwoPhaseCommitProtocol extends VSAbstractProtocol {
+ /** The serial version uid */
private static final long serialVersionUID = 1L;
/**
- * Instantiates a one phase commit protocol.
+ * Instantiates a one phase commit protocol object.
*/
public VSTwoPhaseCommitProtocol() {
super(VSAbstractProtocol.HAS_ON_SERVER_START);
@@ -46,7 +50,9 @@ public class VSTwoPhaseCommitProtocol extends VSAbstractProtocol {
/** PIDs of all processes which still have to vote */
private ArrayList<Integer> votePids;
- /** PIDs of all processes which have to acknowledge that they recv the global vote result */
+ /** PIDs of all processes which have to acknowledge that they recv the
+ * global vote result
+ */
private ArrayList<Integer> ackPids;
/** The gloal vote result */
@@ -91,7 +97,8 @@ public class VSTwoPhaseCommitProtocol extends VSAbstractProtocol {
if (votePids.size() != 0) {
long timeout = getLong("timeout") + process.getTime();
- scheduleAt(timeout); /* Will run onServerSchedule() at the specified local time */
+ /* Will run onServerSchedule() at the specified local time */
+ scheduleAt(timeout);
VSMessage message = new VSMessage();
message.setBoolean("wantVote", true);
@@ -99,7 +106,8 @@ public class VSTwoPhaseCommitProtocol extends VSAbstractProtocol {
} else if (ackPids.size() != 0) {
long timeout = getLong("timeout") + process.getTime();
- scheduleAt(timeout); /* Will run onServerSchedule() at the specified local time */
+ /* Will run onServerSchedule() at the specified local time */
+ scheduleAt(timeout);
VSMessage message = new VSMessage();
message.setBoolean("isVoteResult", true);
@@ -120,18 +128,23 @@ public class VSTwoPhaseCommitProtocol extends VSAbstractProtocol {
return;
boolean vote = recvMessage.getBoolean("vote");
- logg("Abstimmung von Prozess " + pid + " erhalten! Ergebnis: " + vote);
+ logg("Abstimmung von Prozess " + pid +
+ " erhalten! Ergebnis: " + vote);
if (!vote)
voteResult = false;
if (votePids.size() == 0) {
- logg("Abstimmungen von allen beteiligten Prozessen erhalten! Globales Ergebnis: " + voteResult);
- /* Remove the active schedule which has been created in the onServerStart method */
+ logg("Abstimmungen von allen beteiligten Prozessen " +
+ "erhalten! Globales Ergebnis: " + voteResult);
+
+ /* Remove the active schedule which has been created in the
+ onServerStart method */
removeSchedules();
/* Create a new schedule and send the vote result */
onServerStart();
}
+
} else if (ackPids.size() != 0 && recvMessage.getBoolean("isAck")) {
Integer pid = recvMessage.getIntegerObj("pid");
if (ackPids.contains(pid))
@@ -140,7 +153,8 @@ public class VSTwoPhaseCommitProtocol extends VSAbstractProtocol {
return;
if (ackPids.size() == 0) {
- /* Remove the active schedule which has been created in the onServerStart method */
+ /* Remove the active schedule which has been created in the
+ onServerStart method */
removeSchedules();
logg("Alle Teilnehmer haben die Abstimmung erhalten");
}
@@ -192,7 +206,8 @@ public class VSTwoPhaseCommitProtocol extends VSAbstractProtocol {
} else if (recvMessage.getBoolean("isVoteResult")) {
boolean voteResult = recvMessage.getBoolean("voteResult");
- logg("Globales Abstimmungsergebnis erhalten. Ergebnis: " + voteResult);
+ logg("Globales Abstimmungsergebnis erhalten. Ergebnis: " +
+ voteResult);
VSMessage message = new VSMessage();
message.setBoolean("isAck", true);