\r
atomic {\r
c = 'w';\r
- for (int i = 0; i < 100; i++) {\r
- directory = global new GlobalString("/home/folder_"+i+"/");\r
- str = new String("/home/folder_"+i+"/");\r
- t = global new Transaction(c, directory);\r
- todoList.push(t);\r
- \r
- for (int j = 0; j < 100; j++) {\r
- file = global new GlobalString(str+"file_"+j);\r
- str2 = new String(str+"file_"+j);\r
- val = global new GlobalString("This is "+str2);\r
- t = global new Transaction(c, file, val);\r
- todoList.push(t);\r
- }\r
- }\r
- \r
- c = 'r';\r
- directory = global new GlobalString("/home/");\r
- t = global new Transaction(c, directory);\r
- todoList.push(t);\r
\r
- directory = global new GlobalString("/home/folder_28/");\r
+ directory = global new GlobalString("/home/folder/");\r
+ str = new String("/home/folder/");\r
t = global new Transaction(c, directory);\r
todoList.push(t);\r
\r
- file = global new GlobalString("/home/folder_98/file_87");\r
- t = global new Transaction(c, file);\r
- todoList.push(t);\r
+ for (int i = 0; i < 1000; i++) {\r
+ file = global new GlobalString(str+"file_"+i);\r
+ str2 = new String(str+"file_"+i);\r
+ val = global new GlobalString("This is "+str2);\r
+ t = global new Transaction(c, file, val);\r
+ todoList.push(t);\r
+ }\r
+ }\r
+\r
+ int rdprob = 95;\r
+ int dirprob = 90;\r
+ int rdwr;\r
+ int isdir;\r
+ int findex;\r
+ Random rand = new Random(0);\r
+\r
+ atomic {\r
+ for (int i = 0; i < 10000; i++) {\r
+ rdwr = rand.nextInt(100);\r
+ isdir = rand.nextInt(100);\r
+ findex = rand.nextInt(1000);\r
+ \r
+ if (rdwr < rdprob) {\r
+ c = 'r';\r
+ if (isdir < dirprob) { // file\r
+ file = global new GlobalString(str+"file_"+findex);\r
+ t = global new Transaction(c, file);\r
+ }\r
+ else { // dir\r
+ directory = global new GlobalString(str);\r
+ t = global new Transaction(c, directory);\r
+ }\r
+ }\r
+ else {\r
+ c = 'w';\r
+ if (isdir < dirprob) { // file\r
+ file = global new GlobalString(str+"file_"+findex);\r
+ str2 = new String(str+"file_"+findex);\r
+ val = global new GlobalString(str2+" has been modified!!");\r
+ t = global new Transaction(c, file, val);\r
+ }\r
+ else { // dir\r
+ directory = global new GlobalString(str+"new_dir_"+findex+"/");\r
+ t = global new Transaction(c, directory);\r
+ }\r
+ }\r
+ todoList.push(t);\r
+ }\r
}\r
}\r
\r
\r
gval = (GlobalString)(fs.get(gkey));\r
if (gval != null) {\r
- System.out.println("<"+gval.toLocalString()+">");\r
+// System.out.println("<"+gval.toLocalString()+">");\r
}\r
else {\r
System.out.println("No such file or directory");\r
iter = list.iterator();\r
while (iter.hasNext() == true) {\r
gval = (GlobalString)(iter.next());\r
- System.out.print("["+gval.toLocalString()+"] ");\r
+// System.out.print("["+gval.toLocalString()+"] ");\r
}\r
- System.out.println("");\r
+// System.out.println("");\r
}\r
else {\r
System.out.println("No such file or directory");\r