Timeline for Is it safe to use ThreadLocal with CompletableFuture?
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 12, 2022 at 9:07 | answer | added | ejxqy | timeline score: -1 | |
Apr 22, 2021 at 3:34 | answer | added | Kaneg | timeline score: 2 | |
Feb 27, 2020 at 7:33 | answer | added | Adrian | timeline score: 3 | |
Sep 7, 2017 at 19:42 | answer | added | Dean Hiller | timeline score: 1 | |
Mar 22, 2017 at 8:00 | comment | added | Alexei Kaigorodov | there is no guarantee on which thread thenApply is executed. If you want access to some common data, place that data in a class variable, and use a method of that class as a parameter to thenApply(). | |
Mar 22, 2017 at 0:11 | comment | added | Franz Wong | @AlexeiKaigorodov How about if I use thenApply instead of thenApplyAsync, does that guarantee I can always execute in the same thread? So I can use ThreadLocal to store/read data. | |
Mar 18, 2017 at 8:13 | comment | added | Alexei Kaigorodov | yes, exactly. Unless you prepare your own thread pool where each thread carries desired ThreadLocal variable. | |
Mar 18, 2017 at 4:30 | history | asked | Franz Wong | CC BY-SA 3.0 |