01: package demo.mtclient;
02:
03: public class serverImpl extends MyServerPOA {
04: private static final int _delay = 245;
05:
06: private void delay() {
07: try {
08: Thread.currentThread().sleep(_delay);
09: } catch (InterruptedException i) {
10: }
11: }
12:
13: public String[] arryfy(String s, int i) {
14: String result[] = new String[i];
15: for (int j = 0; j < i; j++)
16: result[j] = s;
17: delay();
18: return result;
19: }
20:
21: public String writeMessage(String s) {
22: System.out.println("Message from " + s);
23: delay();
24: return s + " written";
25: }
26:
27: public String writeMessages(String[] s, Observer _observer) {
28: for (int i = 0; i < s.length; i++)
29: System.out.print("Message: " + s[i] + ", ");
30:
31: delay();
32:
33: _observer.update1(_observer);
34: _observer.update2();
35: return "ok.";
36: }
37: }
|