Skip to content

Commit 48b5305

Browse files
committed
Notify listeners when the scope top changes after switching coroutines
1 parent 37ba1f6 commit 48b5305

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

dd-trace-core/src/main/java/datadog/trace/core/scopemanager/ContinuableScopeManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,13 @@ private class ContinuableScopeState implements ScopeState {
384384

385385
@Override
386386
public void activate() {
387+
ContinuableScope oldScope = tlsScopeStack.get().top;
387388
tlsScopeStack.set(localScopeStack);
389+
ContinuableScope newScope = localScopeStack.top;
390+
if (oldScope != newScope && newScope != null) {
391+
newScope.beforeActivated();
392+
newScope.afterActivated();
393+
}
388394
}
389395

390396
@Override

0 commit comments

Comments
 (0)