From: bdemsky Date: Tue, 3 Mar 2009 07:24:28 +0000 (+0000) Subject: changes X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d979d1bfe353e18822b84cd20754f0183b87880a;p=IRC.git changes --- diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpClient.java b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpClient.java index 54bd3729..b26ea5d5 100644 --- a/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpClient.java +++ b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpClient.java @@ -35,9 +35,10 @@ public class LookUpClient { LookUpClient.parseCmdLine(args, lc); Socket sock = new Socket("dc-1.calit2.uci.edu",9001); + Random rand = new Random(0); + for (int i = 0; i < lc.numtrans; i++) { - Random rand = new Random(i); for (int j = 0; j < lc.nLookUp; j++) { int rdwr = rand.nextInt(100); int rwkey = rand.nextInt(lc.nobjs); diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServerThread.java b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServerThread.java index 20ac75e3..83adafa5 100644 --- a/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServerThread.java +++ b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServerThread.java @@ -8,6 +8,7 @@ public class LookUpServerThread extends Thread { } public void run() { + Random r=new Random(0); while(true) { byte b[] = new byte[1]; int numbytes = sock.read(b); @@ -28,7 +29,7 @@ public class LookUpServerThread extends Thread { sock.write(tmpval.intToByteArray()); } else { /* update hashmap if opcode sent is "w" */ - doUpdate(this, keyitem); + doUpdate(r, this, keyitem); } } } @@ -48,9 +49,8 @@ public class LookUpServerThread extends Thread { /** * Synchromize threads accessing hashmap to update key,value pair **/ - synchronized void doUpdate(LookUpServerThread lusth, Integer key) { + synchronized void doUpdate(Random rand, LookUpServerThread lusth, Integer key) { //Write into hmap - Random rand = new Random(0); int val = rand.nextInt(200); Integer value = new Integer(val); Object oldvalue = lusth.hmap.put(key, value);