1 /* |
1 /* |
2 * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. |
2 * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
31 * echo" objects exported by the server. The purpose of these objects |
31 * echo" objects exported by the server. The purpose of these objects |
32 * is simply to recursively call back to their caller. |
32 * is simply to recursively call back to their caller. |
33 */ |
33 */ |
34 public class OrangeEchoImpl extends UnicastRemoteObject implements OrangeEcho { |
34 public class OrangeEchoImpl extends UnicastRemoteObject implements OrangeEcho { |
35 |
35 |
36 private static final Logger logger = |
36 private static final Logger logger = |
37 Logger.getLogger("reliability.orangeecho"); |
37 Logger.getLogger("reliability.orangeecho"); |
38 private final String name; |
38 private final String name; |
39 |
39 |
40 public OrangeEchoImpl(String name) throws RemoteException { |
40 public OrangeEchoImpl(String name) throws RemoteException { |
41 this.name = name; |
41 this.name = name; |
42 } |
42 } |
43 |
43 |
44 /** |
44 /** |
45 * Call back on supplied "orange" object (presumably the caller) |
45 * Call back on supplied "orange" object (presumably the caller) |
46 * with the same message data and a decremented recursion level. |
46 * with the same message data and a decremented recursion level. |
47 */ |
47 */ |
48 public int[] recurse(Orange orange, int[] message, int level) |
48 public int[] recurse(Orange orange, int[] message, int level) |
49 throws RemoteException |
49 throws RemoteException |
50 { |
50 { |
51 String threadName = Thread.currentThread().getName(); |
51 String threadName = Thread.currentThread().getName(); |
52 |
52 |
53 logger.log(Level.FINEST, |
53 logger.log(Level.FINEST, |
54 threadName + ": " + toString() + ".recurse(message[" |
54 threadName + ": " + toString() + ".recurse(message[" |
55 + message.length + "], " + level + "): BEGIN"); |
55 + message.length + "], " + level + "): BEGIN"); |
56 |
56 |
57 int[] response = orange.recurse(this, message, level - 1); |
57 int[] response = orange.recurse(this, message, level - 1); |
58 |
58 |
59 logger.log(Level.FINEST, |
59 logger.log(Level.FINEST, |
60 threadName + ": " + toString() + ".recurse(message[" |
60 threadName + ": " + toString() + ".recurse(message[" |
61 + message.length + "], " + level + "): END"); |
61 + message.length + "], " + level + "): END"); |
62 |
62 |
63 return response; |
63 return response; |
64 } |
64 } |
65 |
65 |
66 public String toString() { |
66 public String toString() { |
67 return name; |
67 return name; |
68 } |
68 } |
69 } |
69 } |