Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/sics-sse/moped
Browse files Browse the repository at this point in the history
  • Loading branch information
arndtjonasson committed Nov 14, 2017
2 parents 4b38558 + e3223b1 commit 8ae7a59
Showing 1 changed file with 31 additions and 15 deletions.
46 changes: 31 additions & 15 deletions plugins/DistPub/src/main/java/plugins/DistPub.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public DistPub(String[] args) {
public static void main(String[] args) {
VM.println("DistPub.main()");
DistPub publish = new DistPub(args);
publish.init();
publish.doFunction();
publish.run();
VM.println("DistPub-main done");
}

Expand All @@ -31,27 +30,44 @@ public void init() {
ff = new PluginRPort(this, "ff");
}

public void run() {}
public void run() {
init();
try {
doFunction();
} catch (InterruptedException e) {
VM.println("**************** Interrupted.");
return;
}
}

public void doFunction() {
public void doFunction() throws InterruptedException {
String data = "";
int cnt = 0;
VM.println("[DistPub X is running]");
while (true) {
cnt += 1;
int val = ff.readInt();
data += " " + val;
VM.println(data);
if (cnt % 20 == 0) {
data = "DistPub| (" + cnt + ")" + data;
int val;
val = ff.readInt();
//val = (2*cnt+1)%300+5;
if (false) {
data += " " + val;
//VM.println(data);
fs.write(data);
data = "";
try {
Thread.sleep(200);
} catch (InterruptedException e) {
VM.println("Interrupted.");
if (cnt % 20 == 0) {
data = "DistPub| (" + cnt + ")" + data;
VM.println(data);
fs.write(data);
data = "";
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
VM.println("Interrupted.");
}
}
} else {
data = "DistPub|" + cnt + " " + val + " ";
//VM.println(data);
fs.write(data);
//Thread.sleep(200);
}
}
}
Expand Down

0 comments on commit 8ae7a59

Please sign in to comment.