From 2ccfe0fb1e158ba704f33b4534c187c48d5544a4 Mon Sep 17 00:00:00 2001
From: adash <adash>
Date: Fri, 20 Feb 2009 20:19:36 +0000
Subject: [PATCH] new files...still need work

---
 .../LookUpService/java/LookUpServer.java      | 19 ++++++
 .../LookUpService/java/LookUpService.java     | 60 +++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServer.java
 create mode 100644 Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpService.java

diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServer.java b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServer.java
new file mode 100644
index 00000000..543ffccb
--- /dev/null
+++ b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpServer.java
@@ -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
index 00000000..f35c4522
--- /dev/null
+++ b/Robust/src/Benchmarks/Distributed/LookUpService/java/LookUpService.java
@@ -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");
+  }
+}
-- 
2.34.1