Graylog2/graylog2-server — pull request #114 by kbrockhoff (2013-02-21 19:35:12+00:00)
Title: Fix problem with AMQP connection not closed if exchange not exists

If an AMQPConsumer tries to subscribe to a non-existent exchange, the disconnect method was throwing an AlreadyClosedException which was not caught. This caused the connection to stay open. With the reconnection mechanism running, eventually the RabbitMQ server will run out of connections. I modified the exception handling in the disconnect() method to ensure the connection is actually closed in all cases.

While working on the class, I also discovered the executor was not being cleaned up properly. The RabbitMQ client only cleans up executors that it creates. Not cleaning up creates a resource leak which will eventually cause Linux to malfunction. I fixed this also.

Note that the changes from my earlier pull request about Apache commons daemon are in this branch.