Skip to content

Commit

Permalink
Added empty constructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
arndtjonasson committed Sep 15, 2017
1 parent ff947c1 commit e3223b1
Showing 1 changed file with 33 additions and 15 deletions.
48 changes: 33 additions & 15 deletions plugins/DistPub/src/main/java/plugins/DistPub.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ public class DistPub extends PlugInComponent {
private PluginPPort fs;
private PluginRPort ff;

public DistPub() {}

public DistPub(String[] args) {
super(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 @@ -29,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 e3223b1

Please sign in to comment.