I'm trying to setup RabbitMQ RPC in a web project (like suggested in
tutorial 6). It works as intended, but when I try to shutdown Tomcat, the shutdown hangs as soon as I have created a consumer listening to the rpc response.
jstack and some debugging learned me that for each created consumer, a thread is created. And those threads are preventing Tomcat from shutting down (as they are not managed by Tomcat).
Looking at ConsumerWorkService, there is a method addWork, which creates a new WorkPoolRunnable and if I have understood it correctly, those Runnable's are only stopped when the 'key', being the channel is stopped.
I find that a bit odd.. I would expect that when I call stub.channel.basicCancel(consumer.getConsumerTag()); the runnable for the consumer is removed.
Or am I completely wrong about my findings and is something else going on?