Skip to content

Instantly share code, notes, and snippets.

@igormukhin
Created October 2, 2016 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igormukhin/8e0d601cd2e16b1ab511324d84db4bfc to your computer and use it in GitHub Desktop.
Save igormukhin/8e0d601cd2e16b1ab511324d84db4bfc to your computer and use it in GitHub Desktop.
Template for demonstrating DCEVM
package sample.dcevm;
import java.util.Date;
public class LongRunning {
private final Worker worker;
public static void main(String[] args) {
new LongRunning(new Worker()).doWork();
}
public LongRunning(Worker worker) {
this.worker = worker;
}
private void doWork() {
new Thread(() -> {
while (true) {
worker.invoke();
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
break;
}
}
}).start();
}
}
class Worker {
public void invoke() {
System.out.println("Date is" + new Date());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment