use of com.creditease.monitor.proxy.spi.JDKProxyInvokeHandler in project uavstack by uavorg.
the class RocketmqIT method doBefore.
public Object doBefore(Object mqClient, String methodName, Object[] args) {
String address = getServerAddr(mqClient);
String topic = getTopic(mqClient, methodName, args);
String url = address + (null == topic ? "" : "/" + topic);
Map<String, Object> params = new HashMap<String, Object>();
params.put(CaptureConstants.INFO_CLIENT_REQUEST_URL, url);
params.put(CaptureConstants.INFO_CLIENT_REQUEST_ACTION, methodName);
params.put(CaptureConstants.INFO_CLIENT_APPID, applicationId);
params.put(CaptureConstants.INFO_CLIENT_TYPE, "rocketmq.client");
if (logger.isDebugable()) {
logger.debug("Invoke START:" + url + ",op=" + methodName, null);
}
// proxy the PullCallback
if (methodName.equals("pull")) {
PullCallback callback = null;
if (PullCallback.class.isAssignableFrom(args[args.length - 1].getClass())) {
callback = (PullCallback) args[args.length - 1];
} else if (PullCallback.class.isAssignableFrom(args[args.length - 1].getClass())) {
callback = (PullCallback) args[args.length - 2];
}
if (null != callback) {
callback = JDKProxyInvokeUtil.newProxyInstance(PullCallback.class.getClassLoader(), new Class<?>[] { PullCallback.class }, new JDKProxyInvokeHandler<PullCallback>(callback, new PullCallbackProxyProcessor()));
ccMap = UAVServer.instance().runMonitorAsyncCaptureOnServerCapPoint(CaptureConstants.CAPPOINT_APP_CLIENT, Monitor.CapturePhase.PRECAP, params, ccMap);
// ivc
ivcContext = captureInvokeChain(RocketMQPullConsumerAdapter.class, InvokeChainConstants.CapturePhase.PRECAP, params, args);
return callback;
}
}
UAVServer.instance().runMonitorCaptureOnServerCapPoint(CaptureConstants.CAPPOINT_APP_CLIENT, Monitor.CapturePhase.PRECAP, params);
if (methodName.startsWith("send")) {
// ivc
ivcContext = captureInvokeChain(RocketMQProducerAdapter.class, InvokeChainConstants.CapturePhase.PRECAP, params, args);
}
return null;
}
use of com.creditease.monitor.proxy.spi.JDKProxyInvokeHandler in project uavstack by uavorg.
the class ApacheAsyncHttpClientIT method doAsyncEnd.
/**
* for async http client
*
* @param args
* @return
*/
@SuppressWarnings({ "rawtypes" })
public Future doAsyncEnd(Object[] args) {
Future f = (Future) args[0];
f = JDKProxyInvokeUtil.newProxyInstance(HttpContext.class.getClassLoader(), new Class<?>[] { Future.class }, new JDKProxyInvokeHandler<Future>(f, new FutureProxyInvokeProcessor(ccMap4Chain)));
return f;
}
use of com.creditease.monitor.proxy.spi.JDKProxyInvokeHandler in project uavstack by uavorg.
the class JdbcDriverIT method doAsyncProxyConnection.
@SuppressWarnings("rawtypes")
public Future doAsyncProxyConnection(Object res) {
Future f = (Future) res;
f = JDKProxyInvokeUtil.newProxyInstance(this.getClass().getClassLoader(), new Class<?>[] { Future.class }, new JDKProxyInvokeHandler<Future>(f, new FutureProxyInvokeProcessor()));
return f;
}
use of com.creditease.monitor.proxy.spi.JDKProxyInvokeHandler in project uavstack by uavorg.
the class JaxWSCxfHookIT method create.
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T create(T t, ClientFactoryBean clientFactoryBean) {
Binding binding = ((BindingProvider) t).getBinding();
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(this.handler);
binding.setHandlerChain(handlerChain);
String wsdlLocation = clientFactoryBean.getAddress();
T tProxy = JDKProxyInvokeUtil.newProxyInstance(clientFactoryBean.getServiceClass().getClassLoader(), new Class[] { clientFactoryBean.getServiceClass() }, new JDKProxyInvokeHandler<T>(t, new ClientStubProcessor(wsdlLocation.toString(), this.handler)));
return tProxy;
}
use of com.creditease.monitor.proxy.spi.JDKProxyInvokeHandler in project uavstack by uavorg.
the class JaxWSHookIT method getPort.
/**
* this is for Client Stub Programming
*
* @param t
* @param s
* @param args
* @return
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T> T getPort(T t, Service s, Object[] args) {
if (JDKProxyInvokeUtil.isJDKProxy(t)) {
return t;
}
Class<T> clz = null;
if (Class.class.isAssignableFrom(args[0].getClass())) {
clz = (Class<T>) args[0];
} else if (Class.class.isAssignableFrom(args[1].getClass())) {
clz = (Class<T>) args[1];
}
if (clz == null) {
return t;
}
Binding binding = ((BindingProvider) t).getBinding();
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(this.handler);
binding.setHandlerChain(handlerChain);
final String wsdlLocation = getServiceURL(s);
T tProxy = JDKProxyInvokeUtil.newProxyInstance(clz.getClassLoader(), new Class[] { clz }, new JDKProxyInvokeHandler<T>(t, new ClientStubProcessor(wsdlLocation.toString(), this.handler)));
return tProxy;
}
Aggregations