public static Scope exec()

in graalvm-native-image-demo/opentelemetry-agent-native/src/main/java/com/alibaba/jvm/ForkJoinTaskAspect.java [30:65]


  public static Scope exec(@Advice.This ForkJoinTask<?> thisRef) {
    try {
      VirtualField<ForkJoinTask<?>, PropagatedContext> virtualField = VirtualField.find(ForkJoinTask.class,
          PropagatedContext.class);
      Scope scope = TaskAdviceHelper.makePropagatedContextCurrent(virtualField, thisRef);
      if (thisRef instanceof Runnable) {
        VirtualField<Runnable, PropagatedContext> runnableVirtualField = VirtualField.find(Runnable.class,
            PropagatedContext.class);
        Scope newScope = TaskAdviceHelper.makePropagatedContextCurrent(runnableVirtualField, (Runnable) thisRef);
        if (null != newScope) {
          if (null != scope) {
            newScope.close();
          } else {
            scope = newScope;
          }
        }
      }
      if (thisRef instanceof Callable) {
        VirtualField<Callable<?>, PropagatedContext> callableVirtualField = VirtualField.find(Callable.class,
            PropagatedContext.class);
        Scope newScope = TaskAdviceHelper.makePropagatedContextCurrent(
            callableVirtualField, (Callable<?>) thisRef);
        if (null != newScope) {
          if (null != scope) {
            newScope.close();
          } else {
            scope = newScope;
          }
        }
      }
      return scope;
    } catch (Throwable t) {
      // suppress exception
      return null;
    }
  }