We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import com.alibaba.ttl.TransmittableThreadLocal; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class Test { private final TransmittableThreadLocal<Integer> context = new TransmittableThreadLocal<>(); private final ThreadLocal<Integer> context2 = new InheritableThreadLocal<>(); private final ExecutorService threadPool = Executors.newFixedThreadPool(10); public static void main(String[] args) throws InterruptedException { Test test = new Test(); for (int i = 100; i < 110; i++) { test.test(i); Thread.sleep(1000); } } public void test(int i) { context.set(i); context2.set(i); System.out.println("===============Start===============" + i); Mono.fromRunnable(() -> { System.out.println("boundedElastic============ttl============" + context.get()); System.out.println("boundedElastic============IT============" + context2.get()); }) .subscribeOn(Schedulers.boundedElastic()) .doOnSubscribe(subscription -> System.out.println("Task submission successful:" + i)) .doFinally(signal -> System.out.println("Task completion signal:" + signal)) .subscribe(); context.remove(); context2.remove(); } }
The above is a test case.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The above is a test case.
The text was updated successfully, but these errors were encountered: