use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.
the class DefaultTrace method traceBlockBegin.
@Override
public SpanEventRecorder traceBlockBegin(final int stackId) {
// Set properties for the case when stackFrame is not used as part of Span.
final SpanEvent spanEvent = new SpanEvent(span);
spanEvent.markStartTime();
spanEvent.setStackId(stackId);
if (this.closed) {
if (isWarn) {
PinpointException exception = new PinpointException("already closed trace.");
logger.warn("[DefaultTrace] Corrupted call stack found.", exception);
}
} else {
callStack.push(spanEvent);
}
return wrappedSpanEventRecorder(spanEvent);
}
use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.
the class DefaultTrace method currentSpanEventRecorder.
@Override
public SpanEventRecorder currentSpanEventRecorder() {
SpanEvent spanEvent = callStack.peek();
if (spanEvent == null) {
if (isWarn) {
PinpointException exception = new PinpointException("call stack is empty");
logger.warn("[DefaultTrace] Corrupted call stack found.", exception);
}
// make dummy.
spanEvent = new SpanEvent(span);
}
return wrappedSpanEventRecorder(spanEvent);
}
use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.
the class DefaultTrace method close.
@Override
public void close() {
if (closed) {
logger.warn("Already closed trace.");
return;
}
closed = true;
if (!callStack.empty()) {
if (isWarn) {
PinpointException exception = new PinpointException("not empty call stack.");
logger.warn("[DefaultTrace] Corrupted call stack found.", exception);
}
// skip
} else {
if (span.isTimeRecording()) {
span.markAfterTime();
}
logSpan(span);
}
this.storage.close();
}
use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.
the class JavassistClass method addInterceptor0.
private int addInterceptor0(String interceptorClassName, Object[] constructorArgs, InterceptorScope scope, ExecutionPolicy executionPolicy) throws InstrumentException {
int interceptorId = -1;
final Class<?> interceptorType = pluginContext.injectClass(classLoader, interceptorClassName);
final TargetMethods targetMethods = interceptorType.getAnnotation(TargetMethods.class);
if (targetMethods != null) {
for (TargetMethod m : targetMethods.value()) {
interceptorId = addInterceptor0(m, interceptorClassName, constructorArgs, scope, executionPolicy);
}
}
final TargetMethod targetMethod = interceptorType.getAnnotation(TargetMethod.class);
if (targetMethod != null) {
interceptorId = addInterceptor0(targetMethod, interceptorClassName, constructorArgs, scope, executionPolicy);
}
final TargetConstructors targetConstructors = interceptorType.getAnnotation(TargetConstructors.class);
if (targetConstructors != null) {
for (TargetConstructor c : targetConstructors.value()) {
interceptorId = addInterceptor0(c, interceptorClassName, scope, executionPolicy, constructorArgs);
}
}
final TargetConstructor targetConstructor = interceptorType.getAnnotation(TargetConstructor.class);
if (targetConstructor != null) {
interceptorId = addInterceptor0(targetConstructor, interceptorClassName, scope, executionPolicy, constructorArgs);
}
final TargetFilter targetFilter = interceptorType.getAnnotation(TargetFilter.class);
if (targetFilter != null) {
interceptorId = addInterceptor0(targetFilter, interceptorClassName, scope, executionPolicy, constructorArgs);
}
if (interceptorId == -1) {
throw new PinpointException("No target is specified. At least one of @Targets, @TargetMethod, @TargetConstructor, @TargetFilter must present. interceptor: " + interceptorClassName);
}
return interceptorId;
}
use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.
the class DebugTransformerClassInjector method injectClass.
@Override
@SuppressWarnings("unchecked")
public <T> Class<? extends T> injectClass(ClassLoader classLoader, String className) {
ClassLoader targetClassLoader = getClassLoader(classLoader);
targetClassLoader = filterBootstrapPackage(targetClassLoader, className);
try {
return (Class<? extends T>) targetClassLoader.loadClass(className);
} catch (ClassNotFoundException e) {
throw new PinpointException("ClassNo class " + className + " with classLoader " + classLoader, e);
}
}
Aggregations