Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

1
  • So, wrapping up: 1. No, this "volatile lambda" scheme won't work. Noted. 2. Re: executor being null for threads in apply(): that's not a problem. The executor just consumes from an existing queue, it's never accessed directly, so no problem if it's created later. I'm more worried about several threads creating several executors. 3. A synchronized block would definitely work, yes; however, it makes my admittedly complex code even more complex. You're right that, in this case, it's probably not worth it; so I've decided to just let the executor be. +1. Commented Mar 1, 2022 at 9:00