[rabbitmq-discuss] Java API methods don't return nor throw exceptions

Jonatan Kallus jonatan at heysan.com
Wed Dec 10 23:42:09 GMT 2008


I am trying to write a java application that can handle the rabbitmq server
going down and coming back up (or losing the connection to the server and
getting it back).

When my application is running and I stop the rabbitmq server, the
ShutdownListener gets called (and some of the disconnection methods may
throw some exceptions). So far all good.

When the server comes back up the application connects to the server: (It
keeps trying to connect while the server is down until it successes.)

ConnectionFactory factory = new ConnectionFactory(params);
connection = factory.newConnection(host, AMQP.PROTOCOL.PORT);
channel = connection.createChannel();
channel.accessRequest(this.realm);

Code above gets run through without any exceptions. But, when reconnecting,
the execution stops at this line, the method seems to never return:

connection.addShutdownListener(shutdownListener);

At first time connection the same code is executed without any problems.

In some cases, when the connection is terminated from within my application,
execution also stops at these lines:

channel.basicCancel(consumerTag);
channel.basicCancel(commandConsumerTag);

I have once seen addShutdownListener throw a
ConcurrentModificationException, but the rabbitmq connection is not running
in a multithreaded environment.

Is it possible to set a general timeout for all API method? Am I missing
anything else wrt this problem? I understand that it may be impossible to
find the cause of this with this little information unless anyone has seen
anything similar. I am ready to supply more information that can help find
the cause of this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20081210/8e55990d/attachment.htm 


More information about the rabbitmq-discuss mailing list