We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c7609a commit e39900aCopy full SHA for e39900a
content/en/docs/languages/java/instrumentation.md
@@ -988,14 +988,12 @@ The following example demonstrates how to propagate the context between threads:
988
989
```java
990
io.opentelemetry.context.Context context = io.opentelemetry.context.Context.current();
991
-Thread thread = new Thread(new Runnable() {
+Thread thread = new Thread(context.wrap(new Runnable() {
992
@Override
993
public void run() {
994
- try (Scope scope = context.makeCurrent()) {
995
- // Code for which you want to propagate the context
996
- }
+ // Code for which you want to propagate the context
997
}
998
-});
+}));
999
thread.start();
1000
```
1001
0 commit comments