Search in sources :

Example 41 with EnhanceCallback

use of com.shulie.instrument.simulator.api.instrument.EnhanceCallback in project LinkAgent by shulieTech.

the class AkkaPlugin method onActive.

@Override
public boolean onActive() throws Throwable {
    this.enhanceTemplate.enhanceWithSuperClass(this, "akka.dispatch.Mailbox", new EnhanceCallback() {

        @Override
        public void doEnhance(InstrumentClass target) {
            InstrumentMethod enqueueMethod = target.getDeclaredMethod("enqueue", "akka.actor.ActorRef", "akka.dispatch.Envelope");
            enqueueMethod.addInterceptor(Listeners.of(MailboxEnqueueInterceptor.class));
            InstrumentMethod dequeueMethod = target.getDeclaredMethod("dequeue");
            dequeueMethod.addInterceptor(Listeners.of(MailboxDequeueInterceptor.class));
        }
    });
    this.enhanceTemplate.enhance(this, "akka.dispatch.Mailbox", new EnhanceCallback() {

        @Override
        public void doEnhance(InstrumentClass target) {
            InstrumentMethod enqueueMethod = target.getDeclaredMethod("enqueue", "akka.actor.ActorRef", "akka.dispatch.Envelope");
            enqueueMethod.addInterceptor(Listeners.of(MailboxEnqueueInterceptor.class));
            InstrumentMethod dequeueMethod = target.getDeclaredMethod("dequeue");
            dequeueMethod.addInterceptor(Listeners.of(MailboxDequeueInterceptor.class));
        }
    });
    return true;
}
Also used : InstrumentClass(com.shulie.instrument.simulator.api.instrument.InstrumentClass) InstrumentMethod(com.shulie.instrument.simulator.api.instrument.InstrumentMethod) EnhanceCallback(com.shulie.instrument.simulator.api.instrument.EnhanceCallback)

Example 42 with EnhanceCallback

use of com.shulie.instrument.simulator.api.instrument.EnhanceCallback in project LinkAgent by shulieTech.

the class AerospikePlugin method addTransformers.

private boolean addTransformers() {
    this.enhanceTemplate.enhance(this, "com.aerospike.client.Key", new EnhanceCallback() {

        @Override
        public void doEnhance(InstrumentClass target) {
            InstrumentMethod method = target.getConstructors();
            method.addInterceptor(Listeners.of(KeyConstructorInterceptor.class, "KEY_SCOPE", ExecutionPolicy.BOUNDARY, Interceptors.SCOPE_CALLBACK));
        }
    });
    this.enhanceTemplate.enhance(this, "com.aerospike.client.AerospikeClient", new EnhanceCallback() {

        @Override
        public void doEnhance(InstrumentClass target) {
            InstrumentMethod method = target.getDeclaredMethods("put", "append", "prepend", "add", "delete", "touch", "exists", "exists", "get", "getHeader", "operate", "getLargeList", "getLargeMap", "getLargeStack", "execute", "query", "queryNode", "queryAggregate");
            method.addInterceptor(Listeners.of(AreospikeOperateInterceptor.class));
            InstrumentMethod scanNodeMethod = target.getDeclaredMethods("scanNode");
            scanNodeMethod.addInterceptor(Listeners.of(ScanNodeParameterWrapInterceptor.class));
            InstrumentMethod scanAllMethod = target.getDeclaredMethods("scanAll");
            scanAllMethod.addInterceptor(Listeners.of(ScanAllParameterWrapInterceptor.class));
        }
    });
    this.enhanceTemplate.enhance(this, "com.aerospike.client.async.AsyncClient", new EnhanceCallback() {

        @Override
        public void doEnhance(InstrumentClass target) {
            InstrumentMethod method = target.getDeclaredMethods("put", "append", "prepend", "add", "delete", "touch", "exists", "exists", "get", "getHeader", "operate", "getLargeList", "getLargeMap", "getLargeStack", "execute", "query", "queryNode", "queryAggregate");
            method.addInterceptor(Listeners.of(AreospikeOperateInterceptor.class));
            InstrumentMethod scanNodeMethod = target.getDeclaredMethods("scanNode");
            scanNodeMethod.addInterceptor(Listeners.of(ScanNodeParameterWrapInterceptor.class));
            scanNodeMethod.addInterceptor(Listeners.of(ScanNodeParameterWrapInterceptor.class));
            InstrumentMethod scanAllMethod = target.getDeclaredMethods("scanAll");
            scanAllMethod.addInterceptor(Listeners.of(ScanAllParameterWrapInterceptor.class));
            scanAllMethod.addInterceptor(Listeners.of(AreospikeScanAllInterceptor.class));
        }
    });
    return true;
}
Also used : InstrumentClass(com.shulie.instrument.simulator.api.instrument.InstrumentClass) InstrumentMethod(com.shulie.instrument.simulator.api.instrument.InstrumentMethod) EnhanceCallback(com.shulie.instrument.simulator.api.instrument.EnhanceCallback)

Aggregations

EnhanceCallback (com.shulie.instrument.simulator.api.instrument.EnhanceCallback)42 InstrumentClass (com.shulie.instrument.simulator.api.instrument.InstrumentClass)42 InstrumentMethod (com.shulie.instrument.simulator.api.instrument.InstrumentMethod)41 XxlJobAdapter (com.pamirs.attach.plugin.shadowjob.adapter.XxlJobAdapter)1 IEvent (com.pamirs.pradar.pressurement.agent.event.IEvent)1 ClusterTestSwitchOffEvent (com.pamirs.pradar.pressurement.agent.event.impl.ClusterTestSwitchOffEvent)1 ClusterTestSwitchOnEvent (com.pamirs.pradar.pressurement.agent.event.impl.ClusterTestSwitchOnEvent)1 EventResult (com.pamirs.pradar.pressurement.agent.listener.EventResult)1 PradarEventListener (com.pamirs.pradar.pressurement.agent.listener.PradarEventListener)1 ShadowImplListener (com.pamirs.pradar.pressurement.agent.listener.impl.ShadowImplListener)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1