152 * @param method the method that was called |
152 * @param method the method that was called |
153 * @param args the arguments passed in the call. |
153 * @param args the arguments passed in the call. |
154 * @return always null, if the method is a user-defined probe |
154 * @return always null, if the method is a user-defined probe |
155 */ |
155 */ |
156 public Object invoke(Object proxy, Method method, Object[] args) { |
156 public Object invoke(Object proxy, Method method, Object[] args) { |
157 if (method.getDeclaringClass() != providerType) { |
157 Class declaringClass = method.getDeclaringClass(); |
|
158 // not a provider subtype's own method |
|
159 if (declaringClass != providerType) { |
158 try { |
160 try { |
159 return method.invoke(this, args); |
161 // delegate only to methods declared by |
|
162 // com.sun.tracing.Provider or java.lang.Object |
|
163 if (declaringClass == Provider.class || |
|
164 declaringClass == Object.class) { |
|
165 return method.invoke(this, args); |
|
166 } else { |
|
167 assert false; |
|
168 } |
160 } catch (IllegalAccessException e) { |
169 } catch (IllegalAccessException e) { |
161 assert false; |
170 assert false; |
162 } catch (InvocationTargetException e) { |
171 } catch (InvocationTargetException e) { |
163 assert false; |
172 assert false; |
164 } |
173 } |
165 } else if (active) { |
174 } else { |
166 ProbeSkeleton p = probes.get(method); |
175 triggerProbe(method, args); |
167 if (p != null) { |
|
168 // Skips argument check -- already done by javac |
|
169 p.uncheckedTrigger(args); |
|
170 } |
|
171 } |
176 } |
172 return null; |
177 return null; |
173 } |
178 } |
174 |
179 |
175 /** |
180 /** |