changes
authorbdemsky <bdemsky>
Tue, 3 Mar 2009 07:24:28 +0000 (07:24 +0000)
committerbdemsky <bdemsky>
Tue, 3 Mar 2009 07:24:28 +0000 (07:24 +0000)
Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpClient.java
Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServerThread.java

index 54bd37299ea4720ec3ae328e664f8a05ab66e821..b26ea5d5cd77b5a4d73042b1a3fbad7cef0eb493 100644 (file)
@@ -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);
index 20ac75e3ff43af98d9a54f65ca1c4a0a1bef22ea..83adafa51394e8cf795ddcee22fcd6395703206b 100644 (file)
@@ -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);