InputStream in = null;
OutputStream out = null;
try {
- sock = new Socket("dc-1.calit2..uci.edu",9001);
+ sock = new Socket("dc-1.calit2.uci.edu",9001);
+ sock.setTcpNoDelay(true);
in = sock.getInputStream();
out = sock.getOutputStream();
} catch (UnknownHostException e) {
System.out.println("Read failed " + e);
}
+ 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);
}
public void run() {
+ try{
+ sock.setTcpNoDelay(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Random r=new Random(0);
while(true) {
byte b[] = new byte[1];
InputStream in = null;
}
} else {
/* update hashmap if opcode sent is "w" */
- doUpdate(this, keyitem);
+ doUpdate(r, this, keyitem);
}
}
}
/**
* 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);