ManagedExecutorService threads and queues

Jonathan Gallimore <[email protected]>
Newsgroups gmane.comp.java.openejb.devel
Message-ID <CAGRgoZhMNSMcyRG70ciXK3KZZ9vgsFD1-qKxxKyr0i_4duKEJQ@mail.gmail.com>
Hi All

Looking at the definition of a ManagedExecutorService, such as below, it
looks like there isn't a way to force the service to have no queue, and
always use more threads, up to the max threads.

If you consider this definition:

    <Resource
        id="MyManagedExecutor"
        type="javax.enterprise.concurrent.ManagedExecutorService">
        Core=5
        Max=150
        KeepAlive=60s
        Queue=0
        WaitAtShutdown=5s
    </Resource>

Per the logic here:
https://github.com/apache/tomee/blob/758e64e7fb69862c94233669531902b65bc1ab80/container/openejb-core/src/main/java/org/apache/openejb/resource/thread/ManagedExecutorServiceImplFactory.java#L77-L81
,

If size is specified (>0), anything executed will be added to the queue,
and the threadpool will only increase from the core size to the max size
when the queue is full.

If size is 0 or negative, the same behaviour applies, but the queue is
unbounded (so the thread pool will not grow at all).

There's no way to specify a zero sized queue (and always grow the thread
pool up to max; and reject work if all threads are busy and the pools is at
the max size).

What are peoples thoughts on a change like this one?
https://github.com/apache/tomee/pull/2011

This does change the behaviour, and I'm not necessarily a fan of "magic"
numbers - an additional boolean setting to control the behaviour might be
an alternative?

What do you think?

Jon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.