Mercurial > hg > graal-compiler
comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/logging/CountingProxy.java @ 2288:8c426c2891c8
client/server: new interface Remote marks classes that should not be serialized, but called remotely
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 11 Apr 2011 10:37:24 +0200 |
parents | 9e5e83ca2259 |
children |
comparison
equal
deleted
inserted
replaced
2287:66ffa0e99cef | 2288:8c426c2891c8 |
---|---|
20 */ | 20 */ |
21 package com.sun.hotspot.c1x.logging; | 21 package com.sun.hotspot.c1x.logging; |
22 | 22 |
23 import java.lang.reflect.*; | 23 import java.lang.reflect.*; |
24 import java.util.*; | 24 import java.util.*; |
25 | |
26 import com.sun.hotspot.c1x.server.*; | |
25 | 27 |
26 /** | 28 /** |
27 * A java.lang.reflect proxy that hierarchically logs all method invocations along with their parameters and return | 29 * A java.lang.reflect proxy that hierarchically logs all method invocations along with their parameters and return |
28 * values. | 30 * values. |
29 * | 31 * |
64 } | 66 } |
65 return result; | 67 return result; |
66 } | 68 } |
67 | 69 |
68 public static <T> T getProxy(Class<T> interf, T delegate) { | 70 public static <T> T getProxy(Class<T> interf, T delegate) { |
69 Object obj = Proxy.newProxyInstance(interf.getClassLoader(), new Class[] {interf}, new CountingProxy<T>(delegate)); | 71 Class<?>[] interfaces = ReplacingStreams.getAllInterfaces(delegate.getClass()); |
72 Object obj = Proxy.newProxyInstance(interf.getClassLoader(), interfaces, new CountingProxy<T>(delegate)); | |
70 return interf.cast(obj); | 73 return interf.cast(obj); |
71 } | 74 } |
72 | 75 |
73 private static ArrayList<CountingProxy> proxies = new ArrayList<CountingProxy>(); | 76 private static ArrayList<CountingProxy> proxies = new ArrayList<CountingProxy>(); |
74 | 77 |