From 9fad211ecd19c9c732e859655de13b848bdb7aa0 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Mon, 26 Feb 2007 14:48:38 +0000 Subject: [PATCH] changes --- Robust/src/Benchmarks/WebServerJava/Inventory.java | 8 +++++--- Robust/src/Benchmarks/WebServerJava/WebServerThread.java | 3 +-- Robust/src/Runtime/runtime.c | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Robust/src/Benchmarks/WebServerJava/Inventory.java b/Robust/src/Benchmarks/WebServerJava/Inventory.java index 50a9ce6b..7b6ee7c5 100644 --- a/Robust/src/Benchmarks/WebServerJava/Inventory.java +++ b/Robust/src/Benchmarks/WebServerJava/Inventory.java @@ -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()); } } diff --git a/Robust/src/Benchmarks/WebServerJava/WebServerThread.java b/Robust/src/Benchmarks/WebServerJava/WebServerThread.java index 3704e2f5..a11ae99e 100644 --- a/Robust/src/Benchmarks/WebServerJava/WebServerThread.java +++ b/Robust/src/Benchmarks/WebServerJava/WebServerThread.java @@ -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"); } diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index b6d7ff94..1d5d35e1 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -406,7 +406,7 @@ void injectinstructionfailure() { if ((((double)random())/RAND_MAX)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)0) numfailures--; - printf("FAILURE!!!\n"); + printf("FAILURE!!! %d\n",numfailures); threadexit(); } } -- 2.34.1