Javadoc
When used in a ThreadPoolExecutor, this queue will block calls to
ThreadPoolExecutor#execute(Runnable) when the queue is full.
This is done by overriding calls to
LinkedBlockingQueue#offer(Object)with calls to
LinkedBlockingQueue#put(Object), but comes with the caveat
that executor must be built with corePoolSize == maxPoolSize
.
In the context of the
AsyncDispatcherImpl, this is an acceptable caveat,
since we enforce the matching pool sizes.
There are alternative ways of solving this problem, for example we could use a
RejectedExecutionHandler to achieve similar behavior, and allow
for corePoolSize < maxPoolSize
, but not for corePoolSize==0
.
For further discussions on this topic see:
http://stackoverflow.com/a/3518588
http://stackoverflow.com/a/32123535
If the implementation is changed, make sure that that executor is built accordingly.