[rabbitmq-discuss] Limitations with RabbitMQ Java Client
steve at rabbitmq.com
Wed Oct 23 14:51:33 BST 2013
One more point.
As is usual for ThreadPoolExecutor (Java) objects, the threads
in the pool are created on demand. So it is not correct to say that all
connections will have 6 threads created. If you don't use Consumer
callbacks at all, there will only be one connection thread created (for
async communication). Even if you have callbacks, you will have at
most one extra thread per channel.
The default ExecutorService we generate uses a fixed pool of size 5,
which means once 5 are created no more are allocated (requests beyond
this are queued until a thread is free). These threads persist until
the ExecutorService is stopped. This happens automatically when the
connection is closed.
If an ExecutorService is supplied by the application it is never explicitly
stopped by the client.
Steve Powell [Cell: +44-7815-838-558] [RabbitMQ, Pivotal]
“L’enfer, c’est les autres.” Sartre
On 23 Oct 2013, at 11:47, Steve Powell <steve at rabbitmq.com> wrote:
> It is not dangerous to share executors between connections.
> If you supply your own Executor (which you must do if you want to share them), then the client will not shutdown the executor when the connection closes. If you rely on the default, then the (private) executor is closed for you when the connection closes.
> Sharing the executor between multiple connections by default means we would have to have a more complex rule for tidying up the (shared) executor, and possibly some option for setting it off? If the user needs this they can achieve it explicitly at present.
> Steve Powell [Cell: +44-7815-838-558] [RabbitMQ, Pivotal]
> “L’enfer, c’est les autres.” Sartre
> On 23 Oct 2013, at 10:45, Michael Klishin <mklishin at gopivotal.com> wrote:
>> On 23 Oct 2013, at 13:36, Simon MacMullen <simon at rabbitmq.com> wrote:
>>> Actually I don't see why we shouldn't do this by default. I will file a bug...
>> Note that executors cannot be restated and Connection#close shuts down the executor
>> it uses. So sharing executors between connections is quite dangerous.
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.rabbitmq.com
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
More information about the rabbitmq-discuss