Changes
[iotcloud.git] / version2 / src / java / light_fan_embed_benchmark / LightsController.java
index c75821f431b527daf9d5f20679ad60a389f4fdca..46df781187376e224e522ab6ef8bdce863c6cb3a 100644 (file)
@@ -5,8 +5,6 @@ class LightsController {
 
     public static void main(String[] args) throws Exception {
 
-        Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
-        t1.rebuild();
 
         // Bulb 1
         byte[] bulbMacAdd1 = new byte[8];
@@ -89,6 +87,40 @@ class LightsController {
         System.out.println("Starting System");
         int counter = 0;
 
+
+        Table t1 = null;
+        try {
+            t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 321, -1);
+            t1.rebuild();
+        } catch (Error e) {
+
+            e.printStackTrace();
+            for (int i = 0; i < 3; i++) {
+                bulbs.get(i).setColor(0, 100, 100);
+            }
+
+
+
+            while (true) {
+                for (int i = 0; i < 3; i++) {
+                    bulbs.get(i).turnOff();
+                }
+                Thread.sleep(1000);
+
+                for (int i = 0; i < 3; i++) {
+                    bulbs.get(i).turnOn();
+                }
+                Thread.sleep(1000);
+            }
+        }
+
+
+
+
+        // Table t2 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 400, -1);
+        // t2.rebuild();
+
+
         while (true) {
 
             try {
@@ -98,16 +130,21 @@ class LightsController {
                 String pingTimer = Long.toString(System.currentTimeMillis());
                 IoTString ipingTimer = new IoTString(pingTimer);
 
-                t1.update();
+                // t1.update();
                 t1.startTransaction();
                 t1.addKV(ipingTimerKey, ipingTimer);
                 t1.commitTransaction();
 
+                // // t2.update();
+                // t2.startTransaction();
+                // t2.addKV(ipingTimerKey, ipingTimer);
+                // t2.commitTransaction();
+
+
+
+
 
-                
 
-                
-                
 
                 for (int i = 0; i < 3; i++) {
                     IoTString testValA1 = t1.getCommitted(keys.get(i));