diff --git a/agent/src/main/java/com/microsoft/applicationinsights/agent/internal/NopThreadContext.java b/agent/src/main/java/com/microsoft/applicationinsights/agent/internal/NopThreadContext.java index 97b415866ac..981b285d0e8 100644 --- a/agent/src/main/java/com/microsoft/applicationinsights/agent/internal/NopThreadContext.java +++ b/agent/src/main/java/com/microsoft/applicationinsights/agent/internal/NopThreadContext.java @@ -106,8 +106,7 @@ public Timer startTimer(TimerName timerName) { @Override public AuxThreadContext createAuxThreadContext() { - // TODO Auto-generated method stub - return null; + return NopAuxThreadContext.INSTANCE; } @Override @@ -186,4 +185,19 @@ public int getCurrentSuppressionKeyId() { public void setCurrentSuppressionKeyId(int suppressionKeyId) { this.currentSuppressionKeyId = suppressionKeyId; } + + private static class NopAuxThreadContext implements AuxThreadContext { + + private static final AuxThreadContext INSTANCE = new NopAuxThreadContext(); + + @Override + public Span start() { + return NopTransactionService.LOCAL_SPAN; + } + + @Override + public Span startAndMarkAsyncTransactionComplete() { + return NopTransactionService.LOCAL_SPAN; + } + } }