File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
src/main/java/kotlinx/coroutines Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 2222}
2323
2424verifyInstrumentation {
25- passes ' org.jetbrains.kotlinx:kotlinx-coroutines-core:[1.2.0,1.3.0 )'
25+ passes ' org.jetbrains.kotlinx:kotlinx-coroutines-core:[1.2.0,)'
2626 excludeRegex ' .*SNAPSHOT'
2727 excludeRegex ' .*alpha'
2828 excludeRegex ' .*-eap-.*'
29+ excludeRegex ' .*-native-.*'
2930}
Original file line number Diff line number Diff line change 1+ package kotlinx .coroutines ;
2+
3+ import com .newrelic .api .agent .NewRelic ;
4+ import com .newrelic .api .agent .Token ;
5+ import com .newrelic .api .agent .Trace ;
6+ import com .newrelic .api .agent .weaver .MatchType ;
7+ import com .newrelic .api .agent .weaver .NewField ;
8+ import com .newrelic .api .agent .weaver .Weave ;
9+ import com .newrelic .api .agent .weaver .Weaver ;
10+
11+ @ Weave (type =MatchType .BaseClass )
12+ public abstract class DispatchedTask <T > {
13+
14+ @ NewField
15+ protected Token token = null ;
16+
17+ public DispatchedTask (int mode ) {
18+ if (token == null ) {
19+ Token t = NewRelic .getAgent ().getTransaction ().getToken ();
20+ if (t != null && t .isActive ()) {
21+ token = t ;
22+ } else if (t != null ) {
23+ t .expire ();
24+ t = null ;
25+ }
26+ }
27+ }
28+
29+ @ Trace (async =true )
30+ public void run () {
31+ if (token != null ) {
32+ token .linkAndExpire ();
33+ token = null ;
34+ }
35+ Weaver .callOriginal ();
36+ }
37+
38+ }
You can’t perform that action at this time.
0 commit comments