Permalink
Browse files

Normal file writing

  • Loading branch information...
1 parent 5ca9719 commit 1fbf1c1a31ea15a47ded86ecc316ca298397f1f1 @pksunkara committed Sep 13, 2011
Showing with 33 additions and 0 deletions.
  1. +9 −0 VectorClock/FILE
  2. +24 −0 VectorClock/Node.java
View
@@ -0,0 +1,9 @@
+Agent alpha → Initialised mission SuperSecret!
+Agent beta → Initialised mission SuperSecret!
+Agent charlie → Initialised mission SuperSecret!
+Agent alpha → Hacked the super computer!
+Agent beta → Hacked the super computer!
+Agent charlie → Hacked the super computer!
+Agent alpha → Finished mission SuperSecret!
+Agent beta → Finished mission SuperSecret!
+Agent charlie → Finished mission SuperSecret!
View
@@ -1,4 +1,28 @@
+import java.io.*;
+
public class Node {
+
+ private static String nodeName = "";
+
+ private static FileWriter fileStream;
+
public static void main(String[] args) {
+ nodeName = args[0];
+
+ log("Initialised mission SuperSecret!");
+ log("Hacked the super computer!");
+ log("Finished mission SuperSecret!");
}
+
+ private static void log(String msg) {
+ try {
+ fileStream = new FileWriter("FILE", true);
+ fileStream.write("Agent " + nodeName + "" + msg + "\n");
+ fileStream.close();
+ Thread.sleep(2000);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
}

0 comments on commit 1fbf1c1

Please sign in to comment.