less transaction
authorjihoonl <jihoonl>
Thu, 4 Mar 2010 08:16:53 +0000 (08:16 +0000)
committerjihoonl <jihoonl>
Thu, 4 Mar 2010 08:16:53 +0000 (08:16 +0000)
Robust/src/Benchmarks/Recovery/FileSystem/recovery/FileSystem.java

index 071b42ab676d7121bda56f32a0eefdbdb7a17459..62eb2f69e6a9235a652ccbc37fc9d8a989a05354 100644 (file)
@@ -11,6 +11,7 @@ public class FileSystem extends Thread {
        DistributedLinkedList dir_list;\r
        GlobalString inputfile;\r
        int mid;\r
+  int threadid;\r
        \r
        public FileSystem(DistributedHashMap dir, DistributedHashMap fs, DistributedLinkedList dir_list) {\r
                this.dir = dir;\r
@@ -18,11 +19,12 @@ public class FileSystem extends Thread {
                this.dir_list = dir_list;\r
        }\r
        \r
-       public FileSystem(DistributedHashMap dir, DistributedHashMap fs, DistributedLinkedList dir_list, String filename, int mid) {\r
+       public FileSystem(DistributedHashMap dir, DistributedHashMap fs, DistributedLinkedList dir_list, String filename, int mid,int threadid) {\r
                this.dir = dir;\r
                this.fs = fs;\r
                this.dir_list = dir_list;\r
                this.mid = mid;\r
+    this.threadid = threadid;\r
                this.inputfile = global new GlobalString("../data/"+filename + mid);\r
        }\r
 \r
@@ -68,6 +70,7 @@ public class FileSystem extends Thread {
        }\r
 \r
        public void run() {\r
+\r
                Transaction t;\r
 \r
                char command;\r
@@ -89,15 +92,15 @@ public class FileSystem extends Thread {
     long st = System.currentTimeMillis();\r
     long fi;\r
 \r
+                       atomic {\r
                while (!todoList.isEmpty()) {\r
                        t = (Transaction)(todoList.removeFirst());\r
 \r
                        command = t.getCommand();\r
                        key = t.getKey();\r
 \r
-                       atomic {\r
                                gkey = global new GlobalString(key);\r
-                       }\r
+                       \r
 \r
                        index = key.lastindexOf('/');\r
                        if (index+1 == key.length()) \r
@@ -108,33 +111,26 @@ public class FileSystem extends Thread {
                        if (command == 'r') {\r
 //        System.out.println("["+command+"] ["+key+"]");\r
                                if (isDir == true) {\r
-                                       atomic {\r
                                                readDirectory(gkey);\r
-                                       }\r
                        }\r
                        else {\r
-                                       atomic {\r
                                                readFile(gkey);\r
-                                       }\r
                          }\r
                        }\r
                        else if (command == 'c') {\r
 //                             System.out.println("["+command+"] ["+key+"]");\r
                        if (isDir == true) {\r
-                                       atomic {\r
                                                createDirectory(gkey);\r
-                                       }\r
                }\r
                        else {\r
                                        val = t.getValue();\r
-                                       atomic {\r
                                                gval = global new GlobalString(val);\r
                                                createFile(gkey, gval);\r
-                                       }\r
                          }\r
-               }\r
+                 }\r
     }\r
 \r
+                       }\r
     fi = System.currentTimeMillis();\r
 \r
                sleep(3000000);\r
@@ -273,11 +269,11 @@ public class FileSystem extends Thread {
                }\r
                \r
                int[] mid = new int[8];\r
-    /*\r
+   /*\r
                mid[0] = (128<<24)|(195<<16)|(180<<8)|21;//dw-2\r
                mid[1] = (128<<24)|(195<<16)|(180<<8)|26;//dw-7\r
-*/\r
-               mid[0] = (128<<24)|(195<<16)|(136<<8)|162;//dc-1\r
+   */\r
+       mid[0] = (128<<24)|(195<<16)|(136<<8)|162;//dc-1\r
                mid[1] = (128<<24)|(195<<16)|(136<<8)|163;//dc-2\r
                mid[2] = (128<<24)|(195<<16)|(136<<8)|164;//dc-3\r
                mid[3] = (128<<24)|(195<<16)|(136<<8)|165;//dc-4\r
@@ -285,7 +281,7 @@ public class FileSystem extends Thread {
     mid[5] = (128<<24)|(195<<16)|(136<<8)|167;//dc-6\r
                mid[6] = (128<<24)|(195<<16)|(136<<8)|168;//dc-7\r
                mid[7] = (128<<24)|(195<<16)|(136<<8)|169;//dc-8\r
-               \r
+    \r
     FileSystem[] lus;\r
                FileSystem initLus;\r
                \r
@@ -299,7 +295,7 @@ public class FileSystem extends Thread {
 \r
                        lus = global new FileSystem[NUM_THREADS];\r
                        for(int i = 0; i < NUM_THREADS; i++) {\r
-                               lus[i] = global new FileSystem(initLus.dir, initLus.fs, initLus.dir_list, filename, i);\r
+                               lus[i] = global new FileSystem(initLus.dir, initLus.fs, initLus.dir_list, filename, i,mid[i]);\r
                        }\r
                }\r
 \r