01: package test;
02:
03: import dalma.endpoints.input.LineInputEndPoint;
04:
05: import java.io.Serializable;
06:
07: /**
08: * @author Kohsuke Kawaguchi
09: */
10: public class ClickConversation implements Runnable, Serializable {
11: private final int id;
12:
13: public ClickConversation(int id) {
14: this .id = id;
15: }
16:
17: public ClickConversation() {
18: this (idGen++);
19: }
20:
21: private static int idGen = 0;
22:
23: public void run() {
24: out("started");
25: loop(0);
26: out("ended");
27: }
28:
29: private void loop(int depth) {
30: while (true) {
31: out("current loop depth " + depth);
32: String input = LineInputEndPoint.waitForInput();
33: if (input.length() > 0) {
34: loop(depth + 1);
35: } else {
36: return;
37: }
38: }
39: }
40:
41: private void out(String msg) {
42: System.out.println(id + " " + msg);
43:
44: }
45: }
|