Search in sources :

Example 1 with NoOpToken

use of com.newrelic.agent.bridge.NoOpToken in project newrelic-java-agent by newrelic.

the class FlyweightTracerTest method getTokenFromFlyweight.

@Trace(excludeFromTransactionTrace = true, leaf = true)
private void getTokenFromFlyweight() {
    // When you are in a flyweight method you should not be allowed to get a token for async linking due to the
    // fact that we have no real parent tracer to tie the token to. We can revisit this in the future if need be
    // but it would require a significant number of changes to the agent
    Token token = AgentBridge.getAgent().getTransaction().getToken();
    Assert.assertNotNull(token);
    Assert.assertFalse(token.isActive());
    Assert.assertTrue(token instanceof NoOpToken);
}
Also used : Token(com.newrelic.api.agent.Token) NoOpToken(com.newrelic.agent.bridge.NoOpToken) NoOpToken(com.newrelic.agent.bridge.NoOpToken) Trace(com.newrelic.api.agent.Trace)

Aggregations

NoOpToken (com.newrelic.agent.bridge.NoOpToken)1 Token (com.newrelic.api.agent.Token)1 Trace (com.newrelic.api.agent.Trace)1