Author: mrogers
Date: 2006-10-31 11:14:10 +0000 (Tue, 31 Oct 2006)
New Revision: 10750
Added:
trunk/apps/load-balancing-sims/phase7/handlers/ChkInsertHandler.java
trunk/apps/load-balancing-sims/phase7/handlers/ChkRequestHandler.java
trunk/apps/load-balancing-sims/phase7/handlers/MessageHandler.java
trunk/apps/load-balancing-sims/phase7/handlers/RequestHandler.java
trunk/apps/load-balancing-sims/phase7/handlers/SskInsertHandler.java
trunk/apps/load-balancing-sims/phase7/handlers/SskRequestHandler.java
trunk/apps/load-balancing-sims/phase7/sim/
trunk/apps/load-balancing-sims/phase7/sim/Network.java
Removed:
trunk/apps/load-balancing-sims/phase7/ChkInsertHandler.java
trunk/apps/load-balancing-sims/phase7/ChkRequestHandler.java
trunk/apps/load-balancing-sims/phase7/MessageHandler.java
trunk/apps/load-balancing-sims/phase7/Network.java
trunk/apps/load-balancing-sims/phase7/RequestHandler.java
trunk/apps/load-balancing-sims/phase7/SskInsertHandler.java
trunk/apps/load-balancing-sims/phase7/SskRequestHandler.java
Modified:
trunk/apps/load-balancing-sims/phase7/CongestionWindow.java
trunk/apps/load-balancing-sims/phase7/DeadlineQueue.java
trunk/apps/load-balancing-sims/phase7/Event.java
trunk/apps/load-balancing-sims/phase7/EventTarget.java
trunk/apps/load-balancing-sims/phase7/LruCache.java
trunk/apps/load-balancing-sims/phase7/LruMap.java
trunk/apps/load-balancing-sims/phase7/NetworkInterface.java
trunk/apps/load-balancing-sims/phase7/Node.java
trunk/apps/load-balancing-sims/phase7/Packet.java
trunk/apps/load-balancing-sims/phase7/Peer.java
trunk/apps/load-balancing-sims/phase7/Sim.java
trunk/apps/load-balancing-sims/phase7/TokenBucket.java
trunk/apps/load-balancing-sims/phase7/messages/Accepted.java
trunk/apps/load-balancing-sims/phase7/messages/Ack.java
trunk/apps/load-balancing-sims/phase7/messages/Block.java
trunk/apps/load-balancing-sims/phase7/messages/ChkDataFound.java
trunk/apps/load-balancing-sims/phase7/messages/ChkInsert.java
trunk/apps/load-balancing-sims/phase7/messages/ChkRequest.java
trunk/apps/load-balancing-sims/phase7/messages/DataInsert.java
trunk/apps/load-balancing-sims/phase7/messages/DataNotFound.java
trunk/apps/load-balancing-sims/phase7/messages/InsertReply.java
trunk/apps/load-balancing-sims/phase7/messages/Message.java
trunk/apps/load-balancing-sims/phase7/messages/RejectedLoop.java
trunk/apps/load-balancing-sims/phase7/messages/RouteNotFound.java
trunk/apps/load-balancing-sims/phase7/messages/Search.java
trunk/apps/load-balancing-sims/phase7/messages/SskAccepted.java
trunk/apps/load-balancing-sims/phase7/messages/SskDataFound.java
trunk/apps/load-balancing-sims/phase7/messages/SskInsert.java
trunk/apps/load-balancing-sims/phase7/messages/SskPubKey.java
trunk/apps/load-balancing-sims/phase7/messages/SskRequest.java
trunk/apps/load-balancing-sims/phase7/messages/TransfersCompleted.java
Log:
Putting things in packages
Deleted: trunk/apps/load-balancing-sims/phase7/ChkInsertHandler.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/ChkInsertHandler.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/ChkInsertHandler.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,268 +0,0 @@
-// The state of a CHK insert as stored at each node along the path
-
-import java.util.HashSet;
-import messages.*;
-
-class ChkInsertHandler extends MessageHandler implements EventTarget
-{
- private int inState = STARTED; // State of incoming transfer
- private HashSet<Peer> receivers; // Peers that should receive data
- private Block[] blocks; // Store incoming blocks for forwarding
- private int blocksReceived = 0;
-
- public ChkInsertHandler (ChkInsert i, Node node, Peer prev)
- {
- super (i, node, prev);
- receivers = new HashSet<Peer>();
- blocks = new Block[32];
- }
-
- public void start()
- {
- // Wait 10 seconds for the incoming transfer to start
- Event.schedule (this, 10.0, DATA_TIMEOUT, null);
- }
-
- public void handleMessage (Message m, Peer src)
- {
- if (src == prev) {
- if (m instanceof DataInsert)
- handleDataInsert ((DataInsert) m);
- else if (m instanceof Block)
- handleBlock ((Block) m);
- else node.log ("unexpected type for " + m);
- }
- else if (src == next) {
- if (m instanceof Accepted)
- handleAccepted ((Accepted) m);
- else if (m instanceof RejectedLoop)
- handleRejectedLoop ((RejectedLoop) m);
- else if (m instanceof RouteNotFound)
- handleRouteNotFound ((RouteNotFound) m);
- else if (m instanceof InsertReply)
- handleInsertReply ((InsertReply) m);
- else if (m instanceof TransfersCompleted)
- handleCompleted ((TransfersCompleted) m, src);
- else node.log ("unexpected type for " + m);
- }
- else if (receivers.contains (src)) {
- if (m instanceof TransfersCompleted)
- handleCompleted ((TransfersCompleted) m, src);
- else node.log ("unexpected type for " + m);
- }
- else node.log ("unexpected source for " + m);
- }
-
- private void handleDataInsert (DataInsert di)
- {
- if (inState != STARTED) node.log (di + " out of order");
- inState = TRANSFERRING;
- // Start the search
- forwardSearch();
- // Wait for transfer to complete (FIXME: check real timeout)
- Event.schedule (this, 120.0, TRANSFER_IN_TIMEOUT, null);
- }
-
- private void handleBlock (Block b)
- {
- if (inState != TRANSFERRING) node.log (b + " out of order");
- if (blocks[b.index] != null) return; // Ignore duplicates
- blocks[b.index] = b;
- blocksReceived++;
- // Forward the block to all receivers
- for (Peer p : receivers) p.sendMessage (b);
- // If the transfer is complete, consider finishing
- if (blocksReceived == 32) {
- inState = COMPLETED;
- considerFinishing();
- }
- }
-
- private void handleCompleted (TransfersCompleted tc, Peer src)
- {
- receivers.remove (src);
- considerFinishing();
- }
-
- private void handleAccepted (Accepted a)
- {
- if (searchState != SENT) node.log (a + " out of order");
- searchState = ACCEPTED;
- // Wait 120 seconds for a reply to the search
- Event.schedule (this, 120.0, SEARCH_TIMEOUT, next);
- // Add the next hop to the list of receivers
- receivers.add (next);
- next.sendMessage (new DataInsert (id));
- // Send all previously received blocks
- for (int i = 0; i < 32; i++)
- if (blocks[i] != null) next.sendMessage (blocks[i]);
- // Wait for TransfersCompleted (FIXME: check real timeout)
- Event.schedule (this, 240.0, TRANSFER_OUT_TIMEOUT, next);
- }
-
- private void handleRejectedLoop (RejectedLoop rl)
- {
- if (searchState != SENT) node.log (rl + " out of order");
- forwardSearch();
- }
-
- private void handleRouteNotFound (RouteNotFound rnf)
- {
- if (searchState != ACCEPTED) node.log (rnf + " out of order");
- if (rnf.htl < htl) htl = rnf.htl;
- // Use the remaining htl to try another peer
- forwardSearch();
- }
-
- private void handleInsertReply (InsertReply ir)
- {
- if (searchState != ACCEPTED) node.log (ir + " out of order");
- if (prev == null) node.log (this + " succeeded");
- else prev.sendMessage (ir); // Forward the message
- searchState = COMPLETED;
- considerFinishing();
- }
-
- public void forwardSearch()
- {
- next = null;
- // If the search has run out of hops, send InsertReply
- if (htl == 0) {
- node.log (this + " has no hops left");
- if (prev == null) node.log (this + " succeeded");
- else prev.sendMessage (new InsertReply (id));
- searchState = COMPLETED;
- considerFinishing();
- return;
- }
- // Forward the search to the closest remaining peer
- next = closestPeer();
- if (next == null) {
- node.log ("route not found for " + this);
- if (prev == null) node.log (this + " failed");
- else prev.sendMessage (new RouteNotFound (id, htl));
- searchState = COMPLETED;
- considerFinishing();
- return;
- }
- // Decrement the htl if the next node is not the closest so far
- double target = Node.keyToLocation (key);
- if (Node.distance (target, next.location)
- > Node.distance (target, closest))
- htl = node.decrementHtl (htl);
- node.log (this + " has htl " + htl);
- node.log ("forwarding " + this + " to " + next.address);
- next.sendMessage (makeSearchMessage());
- nexts.remove (next);
- searchState = SENT;
- // Wait 10 seconds for the next hop to accept the search
- Event.schedule (this, 10.0, ACCEPTED_TIMEOUT, next);
- }
-
- private void considerFinishing()
- {
- // An insert finishes when the search, the incoming transfer
- // and all outgoing transfers are complete
- if (searchState == COMPLETED && inState == COMPLETED
- && receivers.isEmpty()) finish();
- }
-
- private void finish()
- {
- inState = COMPLETED;
- searchState = COMPLETED;
- node.cacheChk (key);
- node.storeChk (key);
- if (prev == null) node.log (this + " completed");
- else prev.sendMessage (new TransfersCompleted (id));
- node.removeMessageHandler (id);
- }
-
- protected Search makeSearchMessage()
- {
- return new ChkInsert (id, key, closest, htl);
- }
-
- public String toString()
- {
- return new String ("CHK insert (" + id + "," + key + ")");
- }
-
- // Event callbacks
-
- private void acceptedTimeout (Peer p)
- {
- if (p != next) return; // We've already moved on to another peer
- if (searchState != SENT) return;
- node.log (this + " accepted timeout waiting for " + p);
- forwardSearch(); // Try another peer
- }
-
- private void searchTimeout (Peer p)
- {
- if (p != next) return; // We've already moved on to another peer
- if (searchState != ACCEPTED) return;
- node.log (this + " search timeout waiting for " + p);
- if (prev == null) node.log (this + " failed");
- searchState = COMPLETED;
- considerFinishing();
- }
-
- private void dataTimeout()
- {
- if (inState != STARTED) return;
- node.log (this + " data timeout waiting for " + prev);
- if (prev == null) node.log (this + " failed");
- else prev.sendMessage (new TransfersCompleted (id));
- finish();
- }
-
- private void transferInTimeout()
- {
- if (inState != TRANSFERRING) return;
- node.log (this + " transfer timeout receiving from " + prev);
- if (prev == null) node.log (this + " failed");
- else prev.sendMessage (new TransfersCompleted (id));
- finish();
- }
-
- private void transferOutTimeout (Peer p)
- {
- if (!receivers.remove (p)) return;
- node.log (this + " transfer timeout sending to " + p);
- considerFinishing();
- }
-
- // EventTarget interface
- public void handleEvent (int type, Object data)
- {
- switch (type) {
- case ACCEPTED_TIMEOUT:
- acceptedTimeout ((Peer) data);
- break;
-
- case SEARCH_TIMEOUT:
- searchTimeout ((Peer) data);
- break;
-
- case DATA_TIMEOUT:
- dataTimeout();
- break;
-
- case TRANSFER_IN_TIMEOUT:
- transferInTimeout();
- break;
-
- case TRANSFER_OUT_TIMEOUT:
- transferOutTimeout ((Peer) data);
- break;
- }
- }
-
- // Each EventTarget class has its own event codes
- private final static int ACCEPTED_TIMEOUT = 1;
- private final static int SEARCH_TIMEOUT = 2;
- private final static int DATA_TIMEOUT = 3;
- private final static int TRANSFER_IN_TIMEOUT = 4;
- private final static int TRANSFER_OUT_TIMEOUT = 5;
-}
Deleted: trunk/apps/load-balancing-sims/phase7/ChkRequestHandler.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/ChkRequestHandler.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/ChkRequestHandler.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,74 +0,0 @@
-// The state of a CHK request as stored at each node along the path
-
-import messages.*;
-
-class ChkRequestHandler extends RequestHandler
-{
- private boolean[] received; // Keep track of received blocks
- private int blocksReceived = 0;
-
- public ChkRequestHandler (ChkRequest r, Node node, Peer prev)
- {
- super (r, node, prev);
- received = new boolean[32];
- }
-
- public void handleMessage (Message m, Peer src)
- {
- if (src != next) {
- node.log ("unexpected source for " + m);
- return;
- }
- if (m instanceof Accepted)
- handleAccepted ((Accepted) m);
- else if (m instanceof RejectedLoop)
- handleRejectedLoop ((RejectedLoop) m);
- else if (m instanceof RouteNotFound)
- handleRouteNotFound ((RouteNotFound) m);
- else if (m instanceof DataNotFound)
- handleDataNotFound ((DataNotFound) m);
- else if (m instanceof ChkDataFound)
- handleChkDataFound ((ChkDataFound) m);
- else if (m instanceof Block)
- handleBlock ((Block) m);
- else node.log ("unexpected type for " + m);
- }
-
- private void handleChkDataFound (ChkDataFound df)
- {
- if (searchState != ACCEPTED) node.log (df + " out of order");
- searchState = TRANSFERRING;
- if (prev != null) prev.sendMessage (df); // Forward the message
- // Wait for the transfer to complete (FIXME: check real timeout)
- Event.schedule (this, 120.0, TRANSFER_TIMEOUT, next);
- }
-
- private void handleBlock (Block b)
- {
- if (searchState != TRANSFERRING) node.log (b + " out of order");
- if (received[b.index]) return; // Ignore duplicates
- received[b.index] = true;
- blocksReceived++;
- // Forward the block
- if (prev != null) {
- node.log ("forwarding " + b);
- prev.sendMessage (b);
- }
- // If the transfer is complete, cache the data
- if (blocksReceived == 32) {
- node.cacheChk (key);
- if (prev == null) node.log (this + " succeeded");
- finish();
- }
- }
-
- protected Search makeSearchMessage()
- {
- return new ChkRequest (id, key, closest, htl);
- }
-
- public String toString()
- {
- return new String ("CHK request (" + id + "," + key + ")");
- }
-}
Modified: trunk/apps/load-balancing-sims/phase7/CongestionWindow.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/CongestionWindow.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/CongestionWindow.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,5 +1,7 @@
// AIMD congestion control
+package sim;
+
class CongestionWindow
{
public final static int MIN_CWIND = Packet.MAX_SIZE; // Min window size
Modified: trunk/apps/load-balancing-sims/phase7/DeadlineQueue.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/DeadlineQueue.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/DeadlineQueue.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,7 +1,8 @@
// A queue storing outgoing messages and their coalescing deadlines
+package sim;
import java.util.LinkedList;
-import messages.Message;
+import sim.messages.Message;
class DeadlineQueue<MESSAGE extends Message>
{
Modified: trunk/apps/load-balancing-sims/phase7/Event.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/Event.java 2006-10-31 11:01:12 UTC
(rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/Event.java 2006-10-31 11:14:10 UTC
(rev 10750)
@@ -1,3 +1,4 @@
+package sim;
import java.util.TreeSet; // Gotta love the collections framework...
class Event implements Comparable
Modified: trunk/apps/load-balancing-sims/phase7/EventTarget.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/EventTarget.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/EventTarget.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,3 +1,5 @@
+package sim;
+
interface EventTarget
{
public void handleEvent (int type, Object data);
Modified: trunk/apps/load-balancing-sims/phase7/LruCache.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/LruCache.java 2006-10-31 11:01:12 UTC
(rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/LruCache.java 2006-10-31 11:14:10 UTC
(rev 10750)
@@ -1,5 +1,6 @@
// Limited-capacity LRU cache
+package sim;
import java.util.LinkedHashSet;
class LruCache<Key>
Modified: trunk/apps/load-balancing-sims/phase7/LruMap.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/LruMap.java 2006-10-31 11:01:12 UTC
(rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/LruMap.java 2006-10-31 11:14:10 UTC
(rev 10750)
@@ -1,5 +1,6 @@
// Limited-capacity LRU cache that stores a value for each key
+package sim;
import java.util.LinkedHashSet;
import java.util.HashMap;
Deleted: trunk/apps/load-balancing-sims/phase7/MessageHandler.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/MessageHandler.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/MessageHandler.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,72 +0,0 @@
-// The state of a search as stored at each node along the path
-
-import java.util.LinkedList;
-import messages.Search;
-import messages.Message;
-
-abstract class MessageHandler
-{
- // State machine
- protected final static int STARTED = 0;
- protected final static int SENT = 1;
- protected final static int ACCEPTED = 2;
- protected final static int TRANSFERRING = 3;
- protected final static int COMPLETED = 4;
-
- protected final int id; // The unique ID of the request or insert
- protected final int key; // The target of the search
- protected double closest; // The closest location seen so far
- protected int htl; // Hops to live for backtracking
-
- protected Node node; // The owner of this MessageHandler
- protected Peer prev; // The previous hop of the search
- protected Peer next = null; // The (current) next hop of the search
- protected LinkedList<Peer> nexts; // Candidates for the next hop
- protected int searchState = STARTED; // The state of the search
-
- public MessageHandler (Search s, Node node, Peer prev)
- {
- id = s.id;
- key = s.key;
- closest = s.closest;
- htl = s.htl;
- this.node = node;
- this.prev = prev;
- nexts = new LinkedList<Peer> (node.peers());
- nexts.remove (prev);
- // If this is the closest location seen so far, reset htl
- double target = Node.keyToLocation (key);
- if (Node.distance (target, node.location)
- < Node.distance (target, closest)) {
- node.log ("resetting htl of " + this); // FIXME
- closest = node.location;
- htl = Search.MAX_HTL;
- }
- }
-
- // Remove a peer from the list of candidates for the next hop
- public void removeNextHop (Peer p)
- {
- nexts.remove (p);
- }
-
- // Find the closest remaining peer
- protected Peer closestPeer ()
- {
- double keyLoc = Node.keyToLocation (key);
- double closestDist = Double.POSITIVE_INFINITY;
- Peer closestPeer = null;
- for (Peer peer : nexts) {
- double dist = Node.distance (keyLoc, peer.location);
- if (dist < closestDist) {
- closestDist = dist;
- closestPeer = peer;
- }
- }
- return closestPeer; // Null if the list was empty
- }
-
- public abstract void handleMessage (Message m, Peer src);
-
- protected abstract Search makeSearchMessage();
-}
Deleted: trunk/apps/load-balancing-sims/phase7/Network.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/Network.java 2006-10-31 11:01:12 UTC
(rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/Network.java 2006-10-31 11:14:10 UTC
(rev 10750)
@@ -1,34 +0,0 @@
-import java.util.HashMap;
-
-class Network
-{
- private static HashMap<Integer,NetworkInterface> interfaces
- = new HashMap<Integer,NetworkInterface>();
- private static int nextAddress = 0;
- public static boolean reorder = false; // Can packets be reordered?
- public static double lossRate = 0.0; // Random packet loss
- // FIXME: random packet duplication
-
- // Deliver a packet to an address
- public static void deliver (Packet p)
- {
- NetworkInterface ni = interfaces.get (p.dest);
- if (ni == null) return; // Node doesn't exist or is offline
- // If the network allows reordering, randomise the latency a bit
- if (reorder) p.latency *= (0.95 + Math.random() * 0.1);
- if (Math.random() < lossRate) {
- Event.log (p + " lost by network");
- return;
- }
- // Schedule the arrival of the packet at the destination
- Event.schedule (ni, p.latency, NetworkInterface.RX_QUEUE, p);
- }
-
- // Attach an interface to the network - returns the address
- public static int register (NetworkInterface ni)
- {
- int address = nextAddress++;
- interfaces.put (address, ni);
- return address;
- }
-}
Modified: trunk/apps/load-balancing-sims/phase7/NetworkInterface.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/NetworkInterface.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/NetworkInterface.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,3 +1,6 @@
+// A node's low-level network interface
+
+package sim;
import java.util.LinkedList;
class NetworkInterface implements EventTarget
Modified: trunk/apps/load-balancing-sims/phase7/Node.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/Node.java 2006-10-31 11:01:12 UTC
(rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/Node.java 2006-10-31 11:14:10 UTC
(rev 10750)
@@ -1,3 +1,4 @@
+package sim;
import java.util.HashMap;
import java.util.HashSet;
import java.util.ArrayList;
@@ -2,3 +3,4 @@
import java.util.Collections;
-import messages.*;
+import sim.handlers.*;
+import sim.messages.*;
Modified: trunk/apps/load-balancing-sims/phase7/Packet.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/Packet.java 2006-10-31 11:01:12 UTC
(rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/Packet.java 2006-10-31 11:14:10 UTC
(rev 10750)
@@ -1,8 +1,9 @@
// A low-level packet (as opposed to a high-level message)
+package sim;
import java.util.ArrayList;
-import messages.Message;
-import messages.Ack;
+import sim.messages.Message;
+import sim.messages.Ack;
class Packet
{
Modified: trunk/apps/load-balancing-sims/phase7/Peer.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/Peer.java 2006-10-31 11:01:12 UTC
(rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/Peer.java 2006-10-31 11:14:10 UTC
(rev 10750)
@@ -1,7 +1,8 @@
+package sim;
import java.util.LinkedList;
import java.util.Iterator;
import java.util.HashSet;
-import messages.*;
+import sim.messages.*;
class Peer
{
Deleted: trunk/apps/load-balancing-sims/phase7/RequestHandler.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/RequestHandler.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/RequestHandler.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,136 +0,0 @@
-// The parent class of ChkRequestHandler and SskRequestHandler
-
-import messages.*;
-
-abstract class RequestHandler extends MessageHandler implements EventTarget
-{
- public RequestHandler (Search s, Node node, Peer prev)
- {
- super (s, node, prev);
- }
-
- public void start()
- {
- forwardSearch();
- }
-
- protected void handleAccepted (Accepted a)
- {
- if (searchState != SENT) node.log (a + " out of order");
- searchState = ACCEPTED;
- // Wait 60 seconds for a reply to the search
- Event.schedule (this, 60.0, SEARCH_TIMEOUT, next);
- }
-
- protected void handleRejectedLoop (RejectedLoop rl)
- {
- if (searchState != SENT) node.log (rl + " out of order");
- forwardSearch();
- }
-
- protected void handleRouteNotFound (RouteNotFound rnf)
- {
- if (searchState != ACCEPTED) node.log (rnf + " out of order");
- if (rnf.htl < htl) htl = rnf.htl;
- // Use the remaining htl to try another peer
- forwardSearch();
- }
-
- protected void handleDataNotFound (DataNotFound dnf)
- {
- if (searchState != ACCEPTED) node.log (dnf + " out of order");
- if (prev == null) node.log (this + " failed");
- else prev.sendMessage (dnf); // Forward the message
- finish();
- }
-
- protected void forwardSearch()
- {
- next = null;
- // If the search has run out of hops, send DataNotFound
- if (htl == 0) {
- node.log ("data not found for " + this);
- if (prev == null) node.log (this + " failed");
- else prev.sendMessage (new DataNotFound (id));
- finish();
- return;
- }
- // Forward the search to the closest remaining peer
- next = closestPeer();
- if (next == null) {
- node.log ("route not found for " + this);
- if (prev == null) node.log (this + " failed");
- else prev.sendMessage (new RouteNotFound (id, htl));
- finish();
- return;
- }
- // Decrement the htl if the next node is not the closest so far
- double target = Node.keyToLocation (key);
- if (Node.distance (target, next.location)
- > Node.distance (target, closest))
- htl = node.decrementHtl (htl);
- node.log (this + " has htl " + htl);
- node.log ("forwarding " + this + " to " + next.address);
- next.sendMessage (makeSearchMessage());
- nexts.remove (next);
- searchState = SENT;
- // Wait 5 seconds for the next hop to accept the search
- Event.schedule (this, 5.0, ACCEPTED_TIMEOUT, next);
- }
-
- protected void finish()
- {
- searchState = COMPLETED;
- node.removeMessageHandler (id);
- }
-
- // Event callbacks
-
- protected void acceptedTimeout (Peer p)
- {
- if (p != next) return; // We've already moved on to another peer
- if (searchState != SENT) return;
- node.log (this + " accepted timeout waiting for " + p);
- forwardSearch(); // Try another peer
- }
-
- protected void searchTimeout (Peer p)
- {
- if (p != next) return; // We've already moved on to another peer
- if (searchState != ACCEPTED) return;
- node.log (this + " search timeout waiting for " + p);
- if (prev == null) node.log (this + " failed");
- finish();
- }
-
- protected void transferTimeout (Peer p)
- {
- if (searchState != TRANSFERRING) return;
- node.log (this + " transfer timeout receiving from " + p);
- if (prev == null) node.log (this + " failed");
- finish();
- }
-
- // EventTarget interface
- public void handleEvent (int type, Object data)
- {
- switch (type) {
- case ACCEPTED_TIMEOUT:
- acceptedTimeout ((Peer) data);
- break;
-
- case SEARCH_TIMEOUT:
- searchTimeout ((Peer) data);
- break;
-
- case TRANSFER_TIMEOUT:
- transferTimeout ((Peer) data);
- break;
- }
- }
-
- // Each EventTarget class has its own event codes
- protected final static int ACCEPTED_TIMEOUT = 1;
- protected final static int SEARCH_TIMEOUT = 2;
- protected final static int TRANSFER_TIMEOUT = 3;
-}
Modified: trunk/apps/load-balancing-sims/phase7/Sim.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/Sim.java 2006-10-31 11:01:12 UTC
(rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/Sim.java 2006-10-31 11:14:10 UTC
(rev 10750)
@@ -1,3 +1,5 @@
+package sim;
+
class Sim
{
private final int NODES = 100; // Number of nodes
Deleted: trunk/apps/load-balancing-sims/phase7/SskInsertHandler.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/SskInsertHandler.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/SskInsertHandler.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,218 +0,0 @@
-// The state of an SSK insert as stored at each node along the path
-
-import java.util.HashSet;
-import messages.*;
-
-class SskInsertHandler extends MessageHandler implements EventTarget
-{
- private int searchState = STARTED; // searchState of search
- private SskPubKey pubKey = null;
- private int data; // The data being inserted
-
- public SskInsertHandler (SskInsert i, Node node,
- Peer prev, boolean needPubKey)
- {
- super (i, node, prev);
- data = i.data;
- if (!needPubKey) pubKey = new SskPubKey (id, key);
- }
-
- public void start()
- {
- if (pubKey == null) {
- // Wait 10 seconds for the previous hop to send the key
- Event.schedule (this, 10.0, KEY_TIMEOUT, null);
- }
- else {
- checkCollision();
- forwardSearch();
- }
- }
-
- // Check whether an older version of the data is already stored
- private void checkCollision()
- {
- Integer old = node.fetchSsk (key);
- if (old != null && old != data) {
- node.log (this + " collided");
- if (prev == null) node.log (this + " collided locally");
- else prev.sendMessage (new SskDataFound (id, old));
- // Continue inserting the old data
- data = old;
- return;
- }
- }
-
- public void handleMessage (Message m, Peer src)
- {
- if (src == prev) {
- if (m instanceof SskPubKey)
- handleSskPubKey ((SskPubKey) m);
- else node.log ("unexpected type for " + m);
- }
- else if (src == next) {
- if (m instanceof SskAccepted)
- handleSskAccepted ((SskAccepted) m);
- else if (m instanceof RejectedLoop)
- handleRejectedLoop ((RejectedLoop) m);
- else if (m instanceof RouteNotFound)
- handleRouteNotFound ((RouteNotFound) m);
- else if (m instanceof SskDataFound)
- handleCollision ((SskDataFound) m);
- else if (m instanceof InsertReply)
- handleInsertReply ((InsertReply) m);
- else node.log ("unexpected type for " + m);
- }
- else node.log ("unexpected source for " + m);
- }
-
- private void handleSskPubKey (SskPubKey pk)
- {
- if (searchState != STARTED) node.log (pk + " out of order");
- pubKey = pk;
- checkCollision();
- forwardSearch();
- }
-
- private void handleSskAccepted (SskAccepted sa)
- {
- if (searchState != SENT) node.log (sa + " out of order");
- searchState = ACCEPTED;
- // Wait 60 seconds for a reply to the search
- Event.schedule (this, 60.0, SEARCH_TIMEOUT, next);
- // Send the public key if requested
- if (sa.needPubKey) next.sendMessage (pubKey);
- }
-
- private void handleRejectedLoop (RejectedLoop rl)
- {
- if (searchState != SENT) node.log (rl + " out of order");
- forwardSearch();
- }
-
- private void handleRouteNotFound (RouteNotFound rnf)
- {
- if (searchState != ACCEPTED) node.log (rnf + " out of order");
- if (rnf.htl < htl) htl = rnf.htl;
- // Use the remaining htl to try another peer
- forwardSearch();
- }
-
- private void handleCollision (SskDataFound sdf)
- {
- if (searchState != ACCEPTED) node.log (sdf + " out of order");
- if (prev == null) node.log (this + " collided");
- else prev.sendMessage (sdf); // Forward the message
- data = sdf.data; // Is this safe?
- }
-
- private void handleInsertReply (InsertReply ir)
- {
- if (searchState != ACCEPTED) node.log (ir + " out of order");
- if (prev == null) node.log (this + " succeeded");
- else prev.sendMessage (ir); // Forward the message
- finish();
- }
-
- public void forwardSearch()
- {
- next = null;
- // If the search has run out of hops, send InsertReply
- if (htl == 0) {
- node.log (this + " has no hops left");
- if (prev == null) node.log (this + " succeeded");
- else prev.sendMessage (new InsertReply (id));
- finish();
- return;
- }
- // Forward the search to the closest remaining peer
- next = closestPeer();
- if (next == null) {
- node.log ("route not found for " + this);
- if (prev == null) node.log (this + " failed");
- else prev.sendMessage (new RouteNotFound (id, htl));
- finish();
- return;
- }
- // Decrement the htl if the next node is not the closest so far
- double target = Node.keyToLocation (key);
- if (Node.distance (target, next.location)
- > Node.distance (target, closest))
- htl = node.decrementHtl (htl);
- node.log (this + " has htl " + htl);
- node.log ("forwarding " + this + " to " + next.address);
- next.sendMessage (makeSearchMessage());
- nexts.remove (next);
- searchState = SENT;
- // Wait 10 seconds for the next hop to accept the search
- Event.schedule (this, 10.0, ACCEPTED_TIMEOUT, next);
- }
-
- private void finish()
- {
- searchState = COMPLETED;
- node.cachePubKey (key);
- node.cacheSsk (key, data);
- node.storeSsk (key, data);
- node.removeMessageHandler (id);
- }
-
- protected Search makeSearchMessage()
- {
- return new SskInsert (id, key, data, closest, htl);
- }
-
- public String toString()
- {
- return new String ("SSK insert (" +id+ "," +key+ "," +data+")");
- }
-
- // Event callbacks
-
- private void keyTimeout()
- {
- if (searchState != STARTED) return;
- node.log (this + " key timeout waiting for " + prev);
- finish();
- }
-
- private void acceptedTimeout (Peer p)
- {
- if (p != next) return; // We've already moved on to another peer
- if (searchState != SENT) return;
- node.log (this + " accepted timeout waiting for " + p);
- forwardSearch(); // Try another peer
- }
-
- private void searchTimeout (Peer p)
- {
- if (p != next) return; // We've already moved on to another peer
- if (searchState != ACCEPTED) return;
- node.log (this + " search timeout waiting for " + p);
- if (prev == null) node.log (this + " failed");
- finish();
- }
-
- // EventTarget interface
- public void handleEvent (int type, Object data)
- {
- switch (type) {
- case KEY_TIMEOUT:
- keyTimeout();
- break;
-
- case ACCEPTED_TIMEOUT:
- acceptedTimeout ((Peer) data);
- break;
-
- case SEARCH_TIMEOUT:
- searchTimeout ((Peer) data);
- break;
- }
- }
-
- // Each EventTarget class has its own event codes
- private final static int KEY_TIMEOUT = 1;
- private final static int ACCEPTED_TIMEOUT = 2;
- private final static int SEARCH_TIMEOUT = 3;
-}
Deleted: trunk/apps/load-balancing-sims/phase7/SskRequestHandler.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/SskRequestHandler.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/SskRequestHandler.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,79 +0,0 @@
-// The state of an SSK request as stored at each node along the path
-
-import messages.*;
-
-class SskRequestHandler extends RequestHandler
-{
- private boolean needPubKey; // Ask the next hop for the public key?
- private SskPubKey pubKey = null;
- private SskDataFound dataFound = null;
-
- public SskRequestHandler (SskRequest r, Node node,
- Peer prev, boolean needPubKey)
- {
- super (r, node, prev);
- this.needPubKey = needPubKey;
- if (!needPubKey) pubKey = new SskPubKey (id, key);
- }
-
- public void handleMessage (Message m, Peer src)
- {
- if (src != next) {
- node.log ("unexpected source for " + m);
- return;
- }
- if (m instanceof Accepted)
- handleAccepted ((Accepted) m);
- else if (m instanceof RejectedLoop)
- handleRejectedLoop ((RejectedLoop) m);
- else if (m instanceof RouteNotFound)
- handleRouteNotFound ((RouteNotFound) m);
- else if (m instanceof DataNotFound)
- handleDataNotFound ((DataNotFound) m);
- else if (m instanceof SskDataFound)
- handleSskDataFound ((SskDataFound) m);
- else if (m instanceof SskPubKey)
- handleSskPubKey ((SskPubKey) m);
- else node.log ("unexpected type for " + m);
- }
-
- private void handleSskDataFound (SskDataFound df)
- {
- if (searchState != ACCEPTED) node.log (df + " out of order");
- dataFound = df;
- if (pubKey == null) return; // Keep waiting
- if (prev == null) node.log (this + " succeeded");
- else {
- prev.sendMessage (dataFound);
- if (needPubKey) prev.sendMessage (pubKey);
- }
- node.cachePubKey (key);
- node.cacheSsk (key, dataFound.data);
- finish();
- }
-
- private void handleSskPubKey (SskPubKey pk)
- {
- if (searchState != ACCEPTED) node.log (pk + " out of order");
- pubKey = pk;
- if (dataFound == null) return; // Keep waiting
- if (prev == null) node.log (this + " succeeded");
- else {
- prev.sendMessage (dataFound);
- if (needPubKey) prev.sendMessage (pubKey);
- }
- node.cachePubKey (key);
- node.cacheSsk (key, dataFound.data);
- finish();
- }
-
- protected Search makeSearchMessage()
- {
- return new SskRequest (id, key, closest, htl, pubKey == null);
- }
-
- public String toString()
- {
- return new String ("SSK request (" + id + "," + key + ")");
- }
-}
Modified: trunk/apps/load-balancing-sims/phase7/TokenBucket.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/TokenBucket.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/TokenBucket.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,3 +1,5 @@
+package sim;
+
class TokenBucket
{
private double tokens, rate, size, lastUpdated;
Copied: trunk/apps/load-balancing-sims/phase7/handlers/ChkInsertHandler.java
(from rev 10749, trunk/apps/load-balancing-sims/phase7/ChkInsertHandler.java)
===================================================================
--- trunk/apps/load-balancing-sims/phase7/ChkInsertHandler.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/handlers/ChkInsertHandler.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -0,0 +1,269 @@
+// The state of a CHK insert as stored at each node along the path
+
+package sim.handlers;
+import java.util.HashSet;
+import sim.messages.*;
+
+public class ChkInsertHandler extends MessageHandler implements EventTarget
+{
+ private int inState = STARTED; // State of incoming transfer
+ private HashSet<Peer> receivers; // Peers that should receive data
+ private Block[] blocks; // Store incoming blocks for forwarding
+ private int blocksReceived = 0;
+
+ public ChkInsertHandler (ChkInsert i, Node node, Peer prev)
+ {
+ super (i, node, prev);
+ receivers = new HashSet<Peer>();
+ blocks = new Block[32];
+ }
+
+ public void start()
+ {
+ // Wait 10 seconds for the incoming transfer to start
+ Event.schedule (this, 10.0, DATA_TIMEOUT, null);
+ }
+
+ public void handleMessage (Message m, Peer src)
+ {
+ if (src == prev) {
+ if (m instanceof DataInsert)
+ handleDataInsert ((DataInsert) m);
+ else if (m instanceof Block)
+ handleBlock ((Block) m);
+ else node.log ("unexpected type for " + m);
+ }
+ else if (src == next) {
+ if (m instanceof Accepted)
+ handleAccepted ((Accepted) m);
+ else if (m instanceof RejectedLoop)
+ handleRejectedLoop ((RejectedLoop) m);
+ else if (m instanceof RouteNotFound)
+ handleRouteNotFound ((RouteNotFound) m);
+ else if (m instanceof InsertReply)
+ handleInsertReply ((InsertReply) m);
+ else if (m instanceof TransfersCompleted)
+ handleCompleted ((TransfersCompleted) m, src);
+ else node.log ("unexpected type for " + m);
+ }
+ else if (receivers.contains (src)) {
+ if (m instanceof TransfersCompleted)
+ handleCompleted ((TransfersCompleted) m, src);
+ else node.log ("unexpected type for " + m);
+ }
+ else node.log ("unexpected source for " + m);
+ }
+
+ private void handleDataInsert (DataInsert di)
+ {
+ if (inState != STARTED) node.log (di + " out of order");
+ inState = TRANSFERRING;
+ // Start the search
+ forwardSearch();
+ // Wait for transfer to complete (FIXME: check real timeout)
+ Event.schedule (this, 120.0, TRANSFER_IN_TIMEOUT, null);
+ }
+
+ private void handleBlock (Block b)
+ {
+ if (inState != TRANSFERRING) node.log (b + " out of order");
+ if (blocks[b.index] != null) return; // Ignore duplicates
+ blocks[b.index] = b;
+ blocksReceived++;
+ // Forward the block to all receivers
+ for (Peer p : receivers) p.sendMessage (b);
+ // If the transfer is complete, consider finishing
+ if (blocksReceived == 32) {
+ inState = COMPLETED;
+ considerFinishing();
+ }
+ }
+
+ private void handleCompleted (TransfersCompleted tc, Peer src)
+ {
+ receivers.remove (src);
+ considerFinishing();
+ }
+
+ private void handleAccepted (Accepted a)
+ {
+ if (searchState != SENT) node.log (a + " out of order");
+ searchState = ACCEPTED;
+ // Wait 120 seconds for a reply to the search
+ Event.schedule (this, 120.0, SEARCH_TIMEOUT, next);
+ // Add the next hop to the list of receivers
+ receivers.add (next);
+ next.sendMessage (new DataInsert (id));
+ // Send all previously received blocks
+ for (int i = 0; i < 32; i++)
+ if (blocks[i] != null) next.sendMessage (blocks[i]);
+ // Wait for TransfersCompleted (FIXME: check real timeout)
+ Event.schedule (this, 240.0, TRANSFER_OUT_TIMEOUT, next);
+ }
+
+ private void handleRejectedLoop (RejectedLoop rl)
+ {
+ if (searchState != SENT) node.log (rl + " out of order");
+ forwardSearch();
+ }
+
+ private void handleRouteNotFound (RouteNotFound rnf)
+ {
+ if (searchState != ACCEPTED) node.log (rnf + " out of order");
+ if (rnf.htl < htl) htl = rnf.htl;
+ // Use the remaining htl to try another peer
+ forwardSearch();
+ }
+
+ private void handleInsertReply (InsertReply ir)
+ {
+ if (searchState != ACCEPTED) node.log (ir + " out of order");
+ if (prev == null) node.log (this + " succeeded");
+ else prev.sendMessage (ir); // Forward the message
+ searchState = COMPLETED;
+ considerFinishing();
+ }
+
+ public void forwardSearch()
+ {
+ next = null;
+ // If the search has run out of hops, send InsertReply
+ if (htl == 0) {
+ node.log (this + " has no hops left");
+ if (prev == null) node.log (this + " succeeded");
+ else prev.sendMessage (new InsertReply (id));
+ searchState = COMPLETED;
+ considerFinishing();
+ return;
+ }
+ // Forward the search to the closest remaining peer
+ next = closestPeer();
+ if (next == null) {
+ node.log ("route not found for " + this);
+ if (prev == null) node.log (this + " failed");
+ else prev.sendMessage (new RouteNotFound (id, htl));
+ searchState = COMPLETED;
+ considerFinishing();
+ return;
+ }
+ // Decrement the htl if the next node is not the closest so far
+ double target = Node.keyToLocation (key);
+ if (Node.distance (target, next.location)
+ > Node.distance (target, closest))
+ htl = node.decrementHtl (htl);
+ node.log (this + " has htl " + htl);
+ node.log ("forwarding " + this + " to " + next.address);
+ next.sendMessage (makeSearchMessage());
+ nexts.remove (next);
+ searchState = SENT;
+ // Wait 10 seconds for the next hop to accept the search
+ Event.schedule (this, 10.0, ACCEPTED_TIMEOUT, next);
+ }
+
+ private void considerFinishing()
+ {
+ // An insert finishes when the search, the incoming transfer
+ // and all outgoing transfers are complete
+ if (searchState == COMPLETED && inState == COMPLETED
+ && receivers.isEmpty()) finish();
+ }
+
+ private void finish()
+ {
+ inState = COMPLETED;
+ searchState = COMPLETED;
+ node.cacheChk (key);
+ node.storeChk (key);
+ if (prev == null) node.log (this + " completed");
+ else prev.sendMessage (new TransfersCompleted (id));
+ node.removeMessageHandler (id);
+ }
+
+ protected Search makeSearchMessage()
+ {
+ return new ChkInsert (id, key, closest, htl);
+ }
+
+ public String toString()
+ {
+ return new String ("CHK insert (" + id + "," + key + ")");
+ }
+
+ // Event callbacks
+
+ private void acceptedTimeout (Peer p)
+ {
+ if (p != next) return; // We've already moved on to another peer
+ if (searchState != SENT) return;
+ node.log (this + " accepted timeout waiting for " + p);
+ forwardSearch(); // Try another peer
+ }
+
+ private void searchTimeout (Peer p)
+ {
+ if (p != next) return; // We've already moved on to another peer
+ if (searchState != ACCEPTED) return;
+ node.log (this + " search timeout waiting for " + p);
+ if (prev == null) node.log (this + " failed");
+ searchState = COMPLETED;
+ considerFinishing();
+ }
+
+ private void dataTimeout()
+ {
+ if (inState != STARTED) return;
+ node.log (this + " data timeout waiting for " + prev);
+ if (prev == null) node.log (this + " failed");
+ else prev.sendMessage (new TransfersCompleted (id));
+ finish();
+ }
+
+ private void transferInTimeout()
+ {
+ if (inState != TRANSFERRING) return;
+ node.log (this + " transfer timeout receiving from " + prev);
+ if (prev == null) node.log (this + " failed");
+ else prev.sendMessage (new TransfersCompleted (id));
+ finish();
+ }
+
+ private void transferOutTimeout (Peer p)
+ {
+ if (!receivers.remove (p)) return;
+ node.log (this + " transfer timeout sending to " + p);
+ considerFinishing();
+ }
+
+ // EventTarget interface
+ public void handleEvent (int type, Object data)
+ {
+ switch (type) {
+ case ACCEPTED_TIMEOUT:
+ acceptedTimeout ((Peer) data);
+ break;
+
+ case SEARCH_TIMEOUT:
+ searchTimeout ((Peer) data);
+ break;
+
+ case DATA_TIMEOUT:
+ dataTimeout();
+ break;
+
+ case TRANSFER_IN_TIMEOUT:
+ transferInTimeout();
+ break;
+
+ case TRANSFER_OUT_TIMEOUT:
+ transferOutTimeout ((Peer) data);
+ break;
+ }
+ }
+
+ // Each EventTarget class has its own event codes
+ private final static int ACCEPTED_TIMEOUT = 1;
+ private final static int SEARCH_TIMEOUT = 2;
+ private final static int DATA_TIMEOUT = 3;
+ private final static int TRANSFER_IN_TIMEOUT = 4;
+ private final static int TRANSFER_OUT_TIMEOUT = 5;
+}
Copied: trunk/apps/load-balancing-sims/phase7/handlers/ChkRequestHandler.java
(from rev 10749, trunk/apps/load-balancing-sims/phase7/ChkRequestHandler.java)
===================================================================
--- trunk/apps/load-balancing-sims/phase7/ChkRequestHandler.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/handlers/ChkRequestHandler.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -0,0 +1,75 @@
+// The state of a CHK request as stored at each node along the path
+
+package sim.handlers;
+import sim.messages.*;
+
+public class ChkRequestHandler extends RequestHandler
+{
+ private boolean[] received; // Keep track of received blocks
+ private int blocksReceived = 0;
+
+ public ChkRequestHandler (ChkRequest r, Node node, Peer prev)
+ {
+ super (r, node, prev);
+ received = new boolean[32];
+ }
+
+ public void handleMessage (Message m, Peer src)
+ {
+ if (src != next) {
+ node.log ("unexpected source for " + m);
+ return;
+ }
+ if (m instanceof Accepted)
+ handleAccepted ((Accepted) m);
+ else if (m instanceof RejectedLoop)
+ handleRejectedLoop ((RejectedLoop) m);
+ else if (m instanceof RouteNotFound)
+ handleRouteNotFound ((RouteNotFound) m);
+ else if (m instanceof DataNotFound)
+ handleDataNotFound ((DataNotFound) m);
+ else if (m instanceof ChkDataFound)
+ handleChkDataFound ((ChkDataFound) m);
+ else if (m instanceof Block)
+ handleBlock ((Block) m);
+ else node.log ("unexpected type for " + m);
+ }
+
+ private void handleChkDataFound (ChkDataFound df)
+ {
+ if (searchState != ACCEPTED) node.log (df + " out of order");
+ searchState = TRANSFERRING;
+ if (prev != null) prev.sendMessage (df); // Forward the message
+ // Wait for the transfer to complete (FIXME: check real timeout)
+ Event.schedule (this, 120.0, TRANSFER_TIMEOUT, next);
+ }
+
+ private void handleBlock (Block b)
+ {
+ if (searchState != TRANSFERRING) node.log (b + " out of order");
+ if (received[b.index]) return; // Ignore duplicates
+ received[b.index] = true;
+ blocksReceived++;
+ // Forward the block
+ if (prev != null) {
+ node.log ("forwarding " + b);
+ prev.sendMessage (b);
+ }
+ // If the transfer is complete, cache the data
+ if (blocksReceived == 32) {
+ node.cacheChk (key);
+ if (prev == null) node.log (this + " succeeded");
+ finish();
+ }
+ }
+
+ protected Search makeSearchMessage()
+ {
+ return new ChkRequest (id, key, closest, htl);
+ }
+
+ public String toString()
+ {
+ return new String ("CHK request (" + id + "," + key + ")");
+ }
+}
Copied: trunk/apps/load-balancing-sims/phase7/handlers/MessageHandler.java
(from rev 10749, trunk/apps/load-balancing-sims/phase7/MessageHandler.java)
===================================================================
--- trunk/apps/load-balancing-sims/phase7/MessageHandler.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/handlers/MessageHandler.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -0,0 +1,73 @@
+// The state of a search as stored at each node along the path
+
+package sim.handlers;
+import java.util.LinkedList;
+import sim.messages.Search;
+import sim.messages.Message;
+
+public abstract class MessageHandler
+{
+ // State machine
+ protected final static int STARTED = 0;
+ protected final static int SENT = 1;
+ protected final static int ACCEPTED = 2;
+ protected final static int TRANSFERRING = 3;
+ protected final static int COMPLETED = 4;
+
+ protected final int id; // The unique ID of the request or insert
+ protected final int key; // The target of the search
+ protected double closest; // The closest location seen so far
+ protected int htl; // Hops to live for backtracking
+
+ protected Node node; // The owner of this MessageHandler
+ protected Peer prev; // The previous hop of the search
+ protected Peer next = null; // The (current) next hop of the search
+ protected LinkedList<Peer> nexts; // Candidates for the next hop
+ protected int searchState = STARTED; // The state of the search
+
+ public MessageHandler (Search s, Node node, Peer prev)
+ {
+ id = s.id;
+ key = s.key;
+ closest = s.closest;
+ htl = s.htl;
+ this.node = node;
+ this.prev = prev;
+ nexts = new LinkedList<Peer> (node.peers());
+ nexts.remove (prev);
+ // If this is the closest location seen so far, reset htl
+ double target = Node.keyToLocation (key);
+ if (Node.distance (target, node.location)
+ < Node.distance (target, closest)) {
+ node.log ("resetting htl of " + this); // FIXME
+ closest = node.location;
+ htl = Search.MAX_HTL;
+ }
+ }
+
+ // Remove a peer from the list of candidates for the next hop
+ public void removeNextHop (Peer p)
+ {
+ nexts.remove (p);
+ }
+
+ // Find the closest remaining peer
+ protected Peer closestPeer ()
+ {
+ double keyLoc = Node.keyToLocation (key);
+ double closestDist = Double.POSITIVE_INFINITY;
+ Peer closestPeer = null;
+ for (Peer peer : nexts) {
+ double dist = Node.distance (keyLoc, peer.location);
+ if (dist < closestDist) {
+ closestDist = dist;
+ closestPeer = peer;
+ }
+ }
+ return closestPeer; // Null if the list was empty
+ }
+
+ public abstract void handleMessage (Message m, Peer src);
+
+ protected abstract Search makeSearchMessage();
+}
Copied: trunk/apps/load-balancing-sims/phase7/handlers/RequestHandler.java
(from rev 10749, trunk/apps/load-balancing-sims/phase7/RequestHandler.java)
===================================================================
--- trunk/apps/load-balancing-sims/phase7/RequestHandler.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/handlers/RequestHandler.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -0,0 +1,138 @@
+// The parent class of ChkRequestHandler and SskRequestHandler
+
+package sim.handlers;
+import sim.messages.*;
+
+public abstract class RequestHandler extends MessageHandler
+ implements EventTarget
+{
+ public RequestHandler (Search s, Node node, Peer prev)
+ {
+ super (s, node, prev);
+ }
+
+ public void start()
+ {
+ forwardSearch();
+ }
+
+ protected void handleAccepted (Accepted a)
+ {
+ if (searchState != SENT) node.log (a + " out of order");
+ searchState = ACCEPTED;
+ // Wait 60 seconds for a reply to the search
+ Event.schedule (this, 60.0, SEARCH_TIMEOUT, next);
+ }
+
+ protected void handleRejectedLoop (RejectedLoop rl)
+ {
+ if (searchState != SENT) node.log (rl + " out of order");
+ forwardSearch();
+ }
+
+ protected void handleRouteNotFound (RouteNotFound rnf)
+ {
+ if (searchState != ACCEPTED) node.log (rnf + " out of order");
+ if (rnf.htl < htl) htl = rnf.htl;
+ // Use the remaining htl to try another peer
+ forwardSearch();
+ }
+
+ protected void handleDataNotFound (DataNotFound dnf)
+ {
+ if (searchState != ACCEPTED) node.log (dnf + " out of order");
+ if (prev == null) node.log (this + " failed");
+ else prev.sendMessage (dnf); // Forward the message
+ finish();
+ }
+
+ protected void forwardSearch()
+ {
+ next = null;
+ // If the search has run out of hops, send DataNotFound
+ if (htl == 0) {
+ node.log ("data not found for " + this);
+ if (prev == null) node.log (this + " failed");
+ else prev.sendMessage (new DataNotFound (id));
+ finish();
+ return;
+ }
+ // Forward the search to the closest remaining peer
+ next = closestPeer();
+ if (next == null) {
+ node.log ("route not found for " + this);
+ if (prev == null) node.log (this + " failed");
+ else prev.sendMessage (new RouteNotFound (id, htl));
+ finish();
+ return;
+ }
+ // Decrement the htl if the next node is not the closest so far
+ double target = Node.keyToLocation (key);
+ if (Node.distance (target, next.location)
+ > Node.distance (target, closest))
+ htl = node.decrementHtl (htl);
+ node.log (this + " has htl " + htl);
+ node.log ("forwarding " + this + " to " + next.address);
+ next.sendMessage (makeSearchMessage());
+ nexts.remove (next);
+ searchState = SENT;
+ // Wait 5 seconds for the next hop to accept the search
+ Event.schedule (this, 5.0, ACCEPTED_TIMEOUT, next);
+ }
+
+ protected void finish()
+ {
+ searchState = COMPLETED;
+ node.removeMessageHandler (id);
+ }
+
+ // Event callbacks
+
+ protected void acceptedTimeout (Peer p)
+ {
+ if (p != next) return; // We've already moved on to another peer
+ if (searchState != SENT) return;
+ node.log (this + " accepted timeout waiting for " + p);
+ forwardSearch(); // Try another peer
+ }
+
+ protected void searchTimeout (Peer p)
+ {
+ if (p != next) return; // We've already moved on to another peer
+ if (searchState != ACCEPTED) return;
+ node.log (this + " search timeout waiting for " + p);
+ if (prev == null) node.log (this + " failed");
+ finish();
+ }
+
+ protected void transferTimeout (Peer p)
+ {
+ if (searchState != TRANSFERRING) return;
+ node.log (this + " transfer timeout receiving from " + p);
+ if (prev == null) node.log (this + " failed");
+ finish();
+ }
+
+ // EventTarget interface
+ public void handleEvent (int type, Object data)
+ {
+ switch (type) {
+ case ACCEPTED_TIMEOUT:
+ acceptedTimeout ((Peer) data);
+ break;
+
+ case SEARCH_TIMEOUT:
+ searchTimeout ((Peer) data);
+ break;
+
+ case TRANSFER_TIMEOUT:
+ transferTimeout ((Peer) data);
+ break;
+ }
+ }
+
+ // Each EventTarget class has its own event codes
+ protected final static int ACCEPTED_TIMEOUT = 1;
+ protected final static int SEARCH_TIMEOUT = 2;
+ protected final static int TRANSFER_TIMEOUT = 3;
+}
Copied: trunk/apps/load-balancing-sims/phase7/handlers/SskInsertHandler.java
(from rev 10749, trunk/apps/load-balancing-sims/phase7/SskInsertHandler.java)
===================================================================
--- trunk/apps/load-balancing-sims/phase7/SskInsertHandler.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/handlers/SskInsertHandler.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -0,0 +1,219 @@
+// The state of an SSK insert as stored at each node along the path
+
+package sim.handlers;
+import java.util.HashSet;
+import sim.messages.*;
+
+public class SskInsertHandler extends MessageHandler implements EventTarget
+{
+ private int searchState = STARTED; // searchState of search
+ private SskPubKey pubKey = null;
+ private int data; // The data being inserted
+
+ public SskInsertHandler (SskInsert i, Node node,
+ Peer prev, boolean needPubKey)
+ {
+ super (i, node, prev);
+ data = i.data;
+ if (!needPubKey) pubKey = new SskPubKey (id, key);
+ }
+
+ public void start()
+ {
+ if (pubKey == null) {
+ // Wait 10 seconds for the previous hop to send the key
+ Event.schedule (this, 10.0, KEY_TIMEOUT, null);
+ }
+ else {
+ checkCollision();
+ forwardSearch();
+ }
+ }
+
+ // Check whether an older version of the data is already stored
+ private void checkCollision()
+ {
+ Integer old = node.fetchSsk (key);
+ if (old != null && old != data) {
+ node.log (this + " collided");
+ if (prev == null) node.log (this + " collided locally");
+ else prev.sendMessage (new SskDataFound (id, old));
+ // Continue inserting the old data
+ data = old;
+ return;
+ }
+ }
+
+ public void handleMessage (Message m, Peer src)
+ {
+ if (src == prev) {
+ if (m instanceof SskPubKey)
+ handleSskPubKey ((SskPubKey) m);
+ else node.log ("unexpected type for " + m);
+ }
+ else if (src == next) {
+ if (m instanceof SskAccepted)
+ handleSskAccepted ((SskAccepted) m);
+ else if (m instanceof RejectedLoop)
+ handleRejectedLoop ((RejectedLoop) m);
+ else if (m instanceof RouteNotFound)
+ handleRouteNotFound ((RouteNotFound) m);
+ else if (m instanceof SskDataFound)
+ handleCollision ((SskDataFound) m);
+ else if (m instanceof InsertReply)
+ handleInsertReply ((InsertReply) m);
+ else node.log ("unexpected type for " + m);
+ }
+ else node.log ("unexpected source for " + m);
+ }
+
+ private void handleSskPubKey (SskPubKey pk)
+ {
+ if (searchState != STARTED) node.log (pk + " out of order");
+ pubKey = pk;
+ checkCollision();
+ forwardSearch();
+ }
+
+ private void handleSskAccepted (SskAccepted sa)
+ {
+ if (searchState != SENT) node.log (sa + " out of order");
+ searchState = ACCEPTED;
+ // Wait 60 seconds for a reply to the search
+ Event.schedule (this, 60.0, SEARCH_TIMEOUT, next);
+ // Send the public key if requested
+ if (sa.needPubKey) next.sendMessage (pubKey);
+ }
+
+ private void handleRejectedLoop (RejectedLoop rl)
+ {
+ if (searchState != SENT) node.log (rl + " out of order");
+ forwardSearch();
+ }
+
+ private void handleRouteNotFound (RouteNotFound rnf)
+ {
+ if (searchState != ACCEPTED) node.log (rnf + " out of order");
+ if (rnf.htl < htl) htl = rnf.htl;
+ // Use the remaining htl to try another peer
+ forwardSearch();
+ }
+
+ private void handleCollision (SskDataFound sdf)
+ {
+ if (searchState != ACCEPTED) node.log (sdf + " out of order");
+ if (prev == null) node.log (this + " collided");
+ else prev.sendMessage (sdf); // Forward the message
+ data = sdf.data; // Is this safe?
+ }
+
+ private void handleInsertReply (InsertReply ir)
+ {
+ if (searchState != ACCEPTED) node.log (ir + " out of order");
+ if (prev == null) node.log (this + " succeeded");
+ else prev.sendMessage (ir); // Forward the message
+ finish();
+ }
+
+ public void forwardSearch()
+ {
+ next = null;
+ // If the search has run out of hops, send InsertReply
+ if (htl == 0) {
+ node.log (this + " has no hops left");
+ if (prev == null) node.log (this + " succeeded");
+ else prev.sendMessage (new InsertReply (id));
+ finish();
+ return;
+ }
+ // Forward the search to the closest remaining peer
+ next = closestPeer();
+ if (next == null) {
+ node.log ("route not found for " + this);
+ if (prev == null) node.log (this + " failed");
+ else prev.sendMessage (new RouteNotFound (id, htl));
+ finish();
+ return;
+ }
+ // Decrement the htl if the next node is not the closest so far
+ double target = Node.keyToLocation (key);
+ if (Node.distance (target, next.location)
+ > Node.distance (target, closest))
+ htl = node.decrementHtl (htl);
+ node.log (this + " has htl " + htl);
+ node.log ("forwarding " + this + " to " + next.address);
+ next.sendMessage (makeSearchMessage());
+ nexts.remove (next);
+ searchState = SENT;
+ // Wait 10 seconds for the next hop to accept the search
+ Event.schedule (this, 10.0, ACCEPTED_TIMEOUT, next);
+ }
+
+ private void finish()
+ {
+ searchState = COMPLETED;
+ node.cachePubKey (key);
+ node.cacheSsk (key, data);
+ node.storeSsk (key, data);
+ node.removeMessageHandler (id);
+ }
+
+ protected Search makeSearchMessage()
+ {
+ return new SskInsert (id, key, data, closest, htl);
+ }
+
+ public String toString()
+ {
+ return new String ("SSK insert (" +id+ "," +key+ "," +data+")");
+ }
+
+ // Event callbacks
+
+ private void keyTimeout()
+ {
+ if (searchState != STARTED) return;
+ node.log (this + " key timeout waiting for " + prev);
+ finish();
+ }
+
+ private void acceptedTimeout (Peer p)
+ {
+ if (p != next) return; // We've already moved on to another peer
+ if (searchState != SENT) return;
+ node.log (this + " accepted timeout waiting for " + p);
+ forwardSearch(); // Try another peer
+ }
+
+ private void searchTimeout (Peer p)
+ {
+ if (p != next) return; // We've already moved on to another peer
+ if (searchState != ACCEPTED) return;
+ node.log (this + " search timeout waiting for " + p);
+ if (prev == null) node.log (this + " failed");
+ finish();
+ }
+
+ // EventTarget interface
+ public void handleEvent (int type, Object data)
+ {
+ switch (type) {
+ case KEY_TIMEOUT:
+ keyTimeout();
+ break;
+
+ case ACCEPTED_TIMEOUT:
+ acceptedTimeout ((Peer) data);
+ break;
+
+ case SEARCH_TIMEOUT:
+ searchTimeout ((Peer) data);
+ break;
+ }
+ }
+
+ // Each EventTarget class has its own event codes
+ private final static int KEY_TIMEOUT = 1;
+ private final static int ACCEPTED_TIMEOUT = 2;
+ private final static int SEARCH_TIMEOUT = 3;
+}
Copied: trunk/apps/load-balancing-sims/phase7/handlers/SskRequestHandler.java
(from rev 10749, trunk/apps/load-balancing-sims/phase7/SskRequestHandler.java)
===================================================================
--- trunk/apps/load-balancing-sims/phase7/SskRequestHandler.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/handlers/SskRequestHandler.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -0,0 +1,80 @@
+// The state of an SSK request as stored at each node along the path
+
+package sim.handlers;
+import sim.messages.*;
+
+public class SskRequestHandler extends RequestHandler
+{
+ private boolean needPubKey; // Ask the next hop for the public key?
+ private SskPubKey pubKey = null;
+ private SskDataFound dataFound = null;
+
+ public SskRequestHandler (SskRequest r, Node node,
+ Peer prev, boolean needPubKey)
+ {
+ super (r, node, prev);
+ this.needPubKey = needPubKey;
+ if (!needPubKey) pubKey = new SskPubKey (id, key);
+ }
+
+ public void handleMessage (Message m, Peer src)
+ {
+ if (src != next) {
+ node.log ("unexpected source for " + m);
+ return;
+ }
+ if (m instanceof Accepted)
+ handleAccepted ((Accepted) m);
+ else if (m instanceof RejectedLoop)
+ handleRejectedLoop ((RejectedLoop) m);
+ else if (m instanceof RouteNotFound)
+ handleRouteNotFound ((RouteNotFound) m);
+ else if (m instanceof DataNotFound)
+ handleDataNotFound ((DataNotFound) m);
+ else if (m instanceof SskDataFound)
+ handleSskDataFound ((SskDataFound) m);
+ else if (m instanceof SskPubKey)
+ handleSskPubKey ((SskPubKey) m);
+ else node.log ("unexpected type for " + m);
+ }
+
+ private void handleSskDataFound (SskDataFound df)
+ {
+ if (searchState != ACCEPTED) node.log (df + " out of order");
+ dataFound = df;
+ if (pubKey == null) return; // Keep waiting
+ if (prev == null) node.log (this + " succeeded");
+ else {
+ prev.sendMessage (dataFound);
+ if (needPubKey) prev.sendMessage (pubKey);
+ }
+ node.cachePubKey (key);
+ node.cacheSsk (key, dataFound.data);
+ finish();
+ }
+
+ private void handleSskPubKey (SskPubKey pk)
+ {
+ if (searchState != ACCEPTED) node.log (pk + " out of order");
+ pubKey = pk;
+ if (dataFound == null) return; // Keep waiting
+ if (prev == null) node.log (this + " succeeded");
+ else {
+ prev.sendMessage (dataFound);
+ if (needPubKey) prev.sendMessage (pubKey);
+ }
+ node.cachePubKey (key);
+ node.cacheSsk (key, dataFound.data);
+ finish();
+ }
+
+ protected Search makeSearchMessage()
+ {
+ return new SskRequest (id, key, closest, htl, pubKey == null);
+ }
+
+ public String toString()
+ {
+ return new String ("SSK request (" + id + "," + key + ")");
+ }
+}
Modified: trunk/apps/load-balancing-sims/phase7/messages/Accepted.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/Accepted.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/Accepted.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class Accepted extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/Ack.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/Ack.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/Ack.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class Ack extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/Block.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/Block.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/Block.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,6 +1,6 @@
// A single block of a multi-block transfer (currently 32 blocks per transfer)
-package messages;
+package sim.messages;
public class Block extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/ChkDataFound.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/ChkDataFound.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/ChkDataFound.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class ChkDataFound extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/ChkInsert.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/ChkInsert.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/ChkInsert.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class ChkInsert extends Search
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/ChkRequest.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/ChkRequest.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/ChkRequest.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class ChkRequest extends Search
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/DataInsert.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/DataInsert.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/DataInsert.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class DataInsert extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/DataNotFound.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/DataNotFound.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/DataNotFound.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class DataNotFound extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/InsertReply.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/InsertReply.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/InsertReply.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class InsertReply extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/Message.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/Message.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/Message.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,6 +1,6 @@
// A high-level message (as opposed to a low-level packet)
-package messages;
+package sim.messages;
public class Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/RejectedLoop.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/RejectedLoop.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/RejectedLoop.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class RejectedLoop extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/RouteNotFound.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/RouteNotFound.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/RouteNotFound.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class RouteNotFound extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/Search.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/Search.java 2006-10-31
11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/Search.java 2006-10-31
11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class Search extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/SskAccepted.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/SskAccepted.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/SskAccepted.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class SskAccepted extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/SskDataFound.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/SskDataFound.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/SskDataFound.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class SskDataFound extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/SskInsert.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/SskInsert.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/SskInsert.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class SskInsert extends Search
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/SskPubKey.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/SskPubKey.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/SskPubKey.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class SskPubKey extends Message
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/SskRequest.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/SskRequest.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/SskRequest.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class SskRequest extends Search
{
Modified: trunk/apps/load-balancing-sims/phase7/messages/TransfersCompleted.java
===================================================================
--- trunk/apps/load-balancing-sims/phase7/messages/TransfersCompleted.java
2006-10-31 11:01:12 UTC (rev 10749)
+++ trunk/apps/load-balancing-sims/phase7/messages/TransfersCompleted.java
2006-10-31 11:14:10 UTC (rev 10750)
@@ -1,4 +1,4 @@
-package messages;
+package sim.messages;
public class TransfersCompleted extends Message
{
Copied: trunk/apps/load-balancing-sims/phase7/sim/Network.java (from rev 10749,
trunk/apps/load-balancing-sims/phase7/Network.java)