changes
authorbdemsky <bdemsky>
Mon, 26 Feb 2007 14:48:38 +0000 (14:48 +0000)
committerbdemsky <bdemsky>
Mon, 26 Feb 2007 14:48:38 +0000 (14:48 +0000)
Robust/src/Benchmarks/WebServerJava/Inventory.java
Robust/src/Benchmarks/WebServerJava/WebServerThread.java
Robust/src/Runtime/runtime.c

index 50a9ce6b668a2edb63db837d6a25cccfce7f6d9b..7b6ee7c5a736775b94a734dd85016e09beb0ab1e 100644 (file)
@@ -61,12 +61,12 @@ public class Inventory {
     }
 
     //Display the inventory list
-    public synchronized String inventory(){
+    public synchronized void inventory(Socket s){
        HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item
        HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap 
-       StringBuffer sb = new StringBuffer("");
        int totalvalue=balance;
        while (i.hasNext() == true) {
+           StringBuffer sb = new StringBuffer("");
            Object o = i.next();
            String name = o.toString();
            ItemInfo oo = (ItemInfo) j.next();
@@ -79,10 +79,12 @@ public class Inventory {
            sb.append(p.toString());
            sb.append("\n");
            totalvalue+=oo.quantity*oo.price;
+           s.write(sb.toString().getBytes());
        }
+       StringBuffer sb=new StringBuffer("");
        sb.append("Total value: ");
        sb.append((new Integer(totalvalue)).toString());
        sb.append("\n");
-       return sb.toString();   
+       s.write(sb.toString().getBytes());
     }  
 }
index 3704e2f596c27b8ab54bc035df5fa6a1bed13096..a11ae99e2daba545c13e995abd62b8952739a3c8 100644 (file)
@@ -91,8 +91,7 @@ public class WebServerThread extends Thread {
        } else if (op == 2) { /* Inventory */
            //          System.printString("DEBUG > Calling inventory transaction\n");
            httpresponse();
-           String towrite = inventorylist.inventory(); 
-           sock.write(towrite.getBytes());
+           inventorylist.inventory(sock);      
        } else { /* Error */ 
            //          System.printString("T > Error - Unknown transaction\n");
        }
index b6d7ff94195b708b8ff5139538b4b1f71981b28e..1d5d35e13b493c1551eda5b11eb7d73b171b1acb 100644 (file)
@@ -406,7 +406,7 @@ void injectinstructionfailure() {
     if ((((double)random())/RAND_MAX)<instfailurechance) {
       if (numfailures>0)
        numfailures--;
-      printf("FAILURE!!!\n");
+      printf("FAILURE!!! %d\n",numfailures);
       longjmp(error_handler,11);
     }
   }
@@ -419,7 +419,7 @@ void injectinstructionfailure() {
     if ((((double)random())/RAND_MAX)<instfailurechance) {
       if (numfailures>0)
        numfailures--;
-      printf("FAILURE!!!\n");
+      printf("FAILURE!!! %d\n",numfailures);
       threadexit();
     }
   }