[rabbitmq-discuss] Java client: Closing channel in channel shutdown listener

Simon MacMullen simon at rabbitmq.com
Wed Nov 3 14:35:09 GMT 2010

On 03/11/10 14:19, jiri at krutil.com wrote:
> Using the Java client, I have a shutdown listener registered on a
> channel. When this listener gets invoked, I attempt to close all AMQP
> resources. This includes closing other channels.
> When I attempt to close another channel inside the channel shutdown
> listener, the connection thread seems to hang. The call stack looks like
> this:

Hi Jiri. The shutdown listener is invoked by the connection's mainloop 
thread, so it can't in itself do anything that involves sending data 
over the connection (which includes closing channels).

Do you need to close channels? If the error is hard, the connection will 
be closed and implicitly all channels will close; if the error is soft 
only the channel that caused the error will close and the others will 
keep working.

Cheers, Simon

> BlockingValueOrException<V,E>.uninterruptibleGetValue(int) line: 51
> AMQChannel$SimpleBlockingRpcContinuation(AMQChannel$BlockingRpcContinuation<T>).getReply(int)
> line: 348
> ChannelN.close(int, String, boolean, Throwable, boolean) line: 416
> ChannelN.close(int, String) line: 360
> ChannelN.close() line: 353
> MyClass.shutdownCompleted(ShutdownSignalException) line: 40
> ChannelN(ShutdownNotifierComponent).notifyListeners() line: 74
> ChannelN.processAsync(Command) line: 242
> ChannelN(AMQChannel).handleCompleteInboundCommand(AMQCommand) line: 165
> ChannelN(AMQChannel).handleFrame(Frame) line: 110
> AMQConnection$MainLoop.run() line: 434
> Both broker and Java client are 2.1.0.
> Am I doing something I shouldn't?
> Cheers
> Jiri
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Simon MacMullen
Staff Engineer, RabbitMQ
SpringSource, a division of VMware

More information about the rabbitmq-discuss mailing list