comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/InvocationSocket.java @ 2284:569d3fe7d65c

non-static VMEntries and VMExits, CompilationServer simplifications
author Lukas Stadler <lukas.stadler@jku.at>
date Thu, 07 Apr 2011 15:32:25 +0200
parents 9e5e83ca2259
children 8c426c2891c8
comparison
equal deleted inserted replaced
2282:0309d394eb5f 2284:569d3fe7d65c
37 public class InvocationSocket implements InvocationHandler { 37 public class InvocationSocket implements InvocationHandler {
38 38
39 private final ObjectOutputStream output; 39 private final ObjectOutputStream output;
40 private final ObjectInputStream input; 40 private final ObjectInputStream input;
41 private Object delegate; 41 private Object delegate;
42 private DelegateCallback callback;
42 43
43 public InvocationSocket(ObjectOutputStream output, ObjectInputStream input) { 44 public InvocationSocket(ObjectOutputStream output, ObjectInputStream input) {
44 this.output = output; 45 this.output = output;
45 this.input = input; 46 this.input = input;
46 } 47 }
47 48
48 public void setDelegate(Object delegate) { 49 public void setDelegate(Object delegate) {
49 this.delegate = delegate; 50 this.delegate = delegate;
51 }
52
53 public static interface DelegateCallback {
54 public Object getDelegate();
55 }
56
57 public void setDelegateCallback(DelegateCallback callback) {
58 this.callback = callback;
50 } 59 }
51 60
52 private static class Invocation implements Serializable { 61 private static class Invocation implements Serializable {
53 62
54 public String methodName; 63 public String methodName;
93 throw (RuntimeException) in; 102 throw (RuntimeException) in;
94 } else if (in instanceof Throwable) { 103 } else if (in instanceof Throwable) {
95 throw new RuntimeException((Throwable) in); 104 throw new RuntimeException((Throwable) in);
96 } 105 }
97 106
107 if (delegate == null) {
108 delegate = callback.getDelegate();
109 callback = null;
110 }
111
98 Invocation invoke = (Invocation) in; 112 Invocation invoke = (Invocation) in;
99 Method method = null; 113 Method method = null;
100 for (Method m : delegate.getClass().getDeclaredMethods()) { 114 for (Method m : delegate.getClass().getDeclaredMethods()) {
101 if (invoke.methodName.equals(m.getName())) { 115 if (invoke.methodName.equals(m.getName())) {
102 method = m; 116 method = m;