new files...still need work
authoradash <adash>
Fri, 20 Feb 2009 20:19:36 +0000 (20:19 +0000)
committeradash <adash>
Fri, 20 Feb 2009 20:19:36 +0000 (20:19 +0000)
Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServer.java [new file with mode: 0644]
Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpService.java [new file with mode: 0644]

diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServer.java b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServer.java
new file mode 100644 (file)
index 0000000..543ffcc
--- /dev/null
@@ -0,0 +1,19 @@
+public class LookUpServer extends Thread {
+  public LookUpServer(Socket s) {
+
+  }
+  
+  public void run() {
+    //Do lookup
+    //Do update
+  }
+
+  public void doHashLookUp() {
+
+
+  }
+
+  public void updateHash() {
+
+  }
+}
diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpService.java b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpService.java
new file mode 100644 (file)
index 0000000..f35c452
--- /dev/null
@@ -0,0 +1,60 @@
+public class LookUpService {
+  public static int main(String arg[]) {
+    /**
+     * The initial capacity of hashmap
+     **/
+    int initCapacity = 100;
+
+    /**
+     * The second capacity of hashmap
+     **/
+    int secondCapacity = 100;
+
+    /**
+     * The loadFactor 
+     **/
+    float loadFactor = 0.75f;
+
+    /**
+     * Number of threads 
+     **/
+    int nthreads = 1;
+
+    /**
+     * Number of objects in the hash table 
+     **/
+    int nobjs = 110;
+
+    /**
+     * Create shared hashmap and put values
+     **/
+    DistributedHashMap dhmap;
+    dhmap = new DistributedHashMap(initCapacity,secondCapacity,loadFactor)
+    for(int i = 0; i<nobjs; i++) {
+      Integer key = new Integer(i);
+      Integer val = new Integer(i*i);
+      dhmap.put(key,val);
+    }
+
+    //Create New ServerSocket
+    System.println("Starting main\n");
+    ServerSocket ss = new ServerSocket(9000);
+    acceptConnection(ss);
+  }
+
+  public static void acceptConnection(ServerSocket ss, DistributedHashMap dhmap, int nthreads) {
+    LookUpService[] lus;
+    lus = new LookUpServer[nthreads];
+    for(int i = 0; i<nthreads; i++) {
+      Socket s = ss.accept();
+      lus[i] = new LookUpService(s, dhmap);
+      System.println("Starting threads\n");
+      lus[i].start();
+    }
+
+    for(int i = 0; i<nthreads; i++) {
+      lus[i].join();
+    }
+    System.println("Finished");
+  }
+}