[concurrency-interest] Why does new ScheduledThreadPoolExecutor(0) not throw an exception?
dl at cs.oswego.edu
Sat Dec 6 10:26:17 EST 2008
Bill Pugh wrote:
> The JavaDoc for Java 1.5 says that new ScheduledThreadPoolExecutor(0)
> throws illegal argument exception.
> It should, since such a created ScheduledThreadPoolExecutor is useless.
> It will silently ignore all requests to execute anything.
> But in Java 1.6, the spec was changed to say that it throws an execution
> only if the argument is < 0.
As Martin mentioned, zero is legal, but very rarely useful
(as mentioned in the javadoc) -- it won't completely
ignore requests, it just won't execute them.
Although I can't find it, I think this change helped
satisfy a request to better support phased initialization.
More information about the Concurrency-interest