1 public class LookUpService extends Thread {
2 DistributedHashMap mydhmap;
6 public LookUpService(DistributedHashMap dmap, int threadid, int numthreads) {
8 this.threadid = threadid;
9 this.numthreads = numthreads;
17 // read probability % between 0-99
20 for(int i = 0; i < nobjs; i++) {
21 Integer key = global new Integer(threadid*nobjs+i);
22 Integer val = global new Integer(i);
28 for (int i = 0; i < numtrans; i++) {
29 Random rand = new Random(i);
30 int rdwr = rand.nextInt(100);
31 int rwkey = rand.nextInt(nobjs*numthreads);
32 Integer k = new Integer(rwkey);
34 Integer tmp = mydhmap.get(k);
36 Integer val = global new Integer(i);
42 public static void main(String[] args) {
45 nthreads = Integer.parseInt(args[0]);
47 int[] mid = new int[8];
48 mid[0] = (128<<24)|(195<<16)|(175<<8)|79;//dc-1
49 mid[1] = (128<<24)|(195<<16)|(136<<8)|163;//dc-2
50 mid[2] = (128<<24)|(195<<16)|(136<<8)|164;//dc-3
51 mid[3] = (128<<24)|(195<<16)|(136<<8)|165;//dc-4
52 mid[4] = (128<<24)|(195<<16)|(136<<8)|166;//dc-5
53 mid[5] = (128<<24)|(195<<16)|(136<<8)|167;//dc-6
54 mid[6] = (128<<24)|(195<<16)|(136<<8)|168;//dc-7
55 mid[7] = (128<<24)|(195<<16)|(136<<8)|169;//dc-8
58 DistributedHashMap dhmap;
59 //DistributedHashEntry dhe;
63 dhmap = global new DistributedHashMap(100, 100, 0.75f);
64 lus = global new LookUpService[nthreads];
65 for(int i = 0; i<nthreads; i++) {
66 lus[i] = global new LookUpService(dhmap, i, nthreads);
72 for(int i = 0; i<nthreads; i++) {
80 for(int i = 0; i<nthreads; i++) {
87 System.printString("Finished\n");