Search in sources :

Example 1 with GuardInstrumentor

use of com.navercorp.pinpoint.profiler.instrument.GuardInstrumentor in project pinpoint by naver.

the class MatchableClassFileTransformerDelegate method transform.

@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
    Objects.requireNonNull(className, "className");
    final InstrumentContext instrumentContext = this.instrumentContext;
    final GuardInstrumentor guard = new GuardInstrumentor(this.profilerConfig, instrumentContext);
    try {
        // WARN external plugin api
        final TransformCallback transformCallback = transformCallbackProvider.getTransformCallback(instrumentContext, loader);
        return transformCallback.doInTransform(guard, loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
    } catch (InstrumentException e) {
        throw new PinpointException(e);
    } finally {
        guard.close();
    }
}
Also used : GuardInstrumentor(com.navercorp.pinpoint.profiler.instrument.GuardInstrumentor) InstrumentException(com.navercorp.pinpoint.bootstrap.instrument.InstrumentException) PinpointException(com.navercorp.pinpoint.exception.PinpointException) InstrumentContext(com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext) TransformCallback(com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback)

Example 2 with GuardInstrumentor

use of com.navercorp.pinpoint.profiler.instrument.GuardInstrumentor in project pinpoint by naver.

the class ClassFileTransformerDelegate method transform.

@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
    Objects.requireNonNull(className, "className");
    final InstrumentContext instrumentContext = this.instrumentContext;
    final GuardInstrumentor guard = new GuardInstrumentor(this.profilerConfig, instrumentContext);
    try {
        // WARN external plugin api
        final TransformCallback transformCallback = this.transformCallbackProvider.getTransformCallback(instrumentContext, loader);
        return transformCallback.doInTransform(guard, loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
    } catch (InstrumentException e) {
        throw new PinpointException(e);
    } finally {
        guard.close();
    }
}
Also used : GuardInstrumentor(com.navercorp.pinpoint.profiler.instrument.GuardInstrumentor) InstrumentException(com.navercorp.pinpoint.bootstrap.instrument.InstrumentException) PinpointException(com.navercorp.pinpoint.exception.PinpointException) InstrumentContext(com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext) TransformCallback(com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback)

Aggregations

InstrumentContext (com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext)2 InstrumentException (com.navercorp.pinpoint.bootstrap.instrument.InstrumentException)2 TransformCallback (com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback)2 PinpointException (com.navercorp.pinpoint.exception.PinpointException)2 GuardInstrumentor (com.navercorp.pinpoint.profiler.instrument.GuardInstrumentor)2