use of com.nr.agent.instrumentation.scala.WrappedFunction0 in project newrelic-java-agent by newrelic.
the class FutureInnerClass_Instrumentation method apply.
public <T> scala.concurrent.Future<T> apply(Function0<T> body, final ExecutionContext executor) {
AgentBridge.TokenAndRefCount tokenAndRefCount = AgentBridge.activeToken.get();
if (tokenAndRefCount == null) {
Transaction tx = AgentBridge.getAgent().getTransaction(false);
if (tx != null && (!body.getClass().getName().startsWith("akka."))) {
AgentBridge.TokenAndRefCount tokenAndRef = new AgentBridge.TokenAndRefCount(tx.getToken(), AgentBridge.getAgent().getTracedMethod(), new AtomicInteger(1));
body = new WrappedFunction0(body, tokenAndRef);
}
} else {
body = new WrappedFunction0(body, tokenAndRefCount);
tokenAndRefCount.refCount.incrementAndGet();
}
scala.concurrent.Future<T> value = Weaver.callOriginal();
return value;
}
Aggregations