Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
posting to a shutdown thread pool? #192
If you post to a threadpool that is in
What I would have expected instead, is following whatever is the pool's
But is the present behavior what the java.util.concurrent stuff does? Maybe they have some reason for it, I guess, and I understand wanting to stay consistent. But following the
It is surprising to me to have to check the return value of #post to know if the work is actually going to be done, I'd expect an RejectedExcecution exception by default if posting to a shutdown pool (and since overflow_policy is abort by default, that's what I'd get if it followed overflow policy)
Looks to me like Java thread pools do what I'm suggesting -- they use the overflow policy for work submitted to a shut down pool too.
See "Rejected tasks" at:
Nice catch. Thank you. The overflow policies are a recent addition. The current post-shutdown behavior was written first. The behavior you suggest makes more sense now that we have the overflow policies, consistency with Java's thread pools has always been a goal (Sun/Oracle has some very smart people working on this stuff). We'll make this change in the next release.
added a commit
Dec 7, 2014
referenced this issue
Dec 7, 2014
Awesome. I'm surprised the JRuby optimized thread pools don't already do it if they are using java.util.concurrent.ThreadExecutor under the hood which does it itself.
But if it would be helpful for me to try and help, I can try to find time to take a look and make a PR? Did you already add tests for this behavior that run against the pure-ruby version, and can be run against the Java version too to confirm? Or would be that be the place to start? Do you guys already have a test infrastructure that tests everything against multiple environments to ensure consistent behavior?