Search in sources :

Example 16 with RMQJMSException

use of com.rabbitmq.jms.util.RMQJMSException in project rabbitmq-jms-client by rabbitmq.

the class RMQConnection method close.

/**
 * From the JMS Spec:
 * <blockquote>
 * <p>This call blocks until a
 * receive or message listener in progress has completed. A blocked message consumer receive call returns null when
 * this message consumer is closed.</p>
 * </blockquote>
 * {@inheritDoc}
 */
@Override
public void close() throws JMSException {
    logger.trace("closing connection ({})", this);
    if (this.closed)
        return;
    this.closed = true;
    removeClientID();
    // We null any exception listener since we don't want it driven during close().
    this.exceptionListener.set(null);
    closeAllSessions();
    try {
        this.rabbitConnection.close();
    } catch (ShutdownSignalException x) {
    // nothing to do
    } catch (IOException x) {
        if (!(x.getCause() instanceof ShutdownSignalException)) {
            throw new RMQJMSException(x);
        }
    }
}
Also used : RMQJMSException(com.rabbitmq.jms.util.RMQJMSException) ShutdownSignalException(com.rabbitmq.client.ShutdownSignalException) IOException(java.io.IOException)

Aggregations

RMQJMSException (com.rabbitmq.jms.util.RMQJMSException)16 IOException (java.io.IOException)15 JMSException (javax.jms.JMSException)6 ShutdownSignalException (com.rabbitmq.client.ShutdownSignalException)5 IllegalStateException (javax.jms.IllegalStateException)5 RMQJMSSelectorException (com.rabbitmq.jms.util.RMQJMSSelectorException)4 TimeoutException (java.util.concurrent.TimeoutException)4 InvalidSelectorException (javax.jms.InvalidSelectorException)4 AMQP (com.rabbitmq.client.AMQP)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ObjectOutputStream (java.io.ObjectOutputStream)2 MessageEOFException (javax.jms.MessageEOFException)2 MessageNotWriteableException (javax.jms.MessageNotWriteableException)2 Channel (com.rabbitmq.client.Channel)1 RMQBytesMessage (com.rabbitmq.jms.client.message.RMQBytesMessage)1 RMQTextMessage (com.rabbitmq.jms.client.message.RMQTextMessage)1 RMQMessageFormatException (com.rabbitmq.jms.util.RMQMessageFormatException)1 WhiteListObjectInputStream (com.rabbitmq.jms.util.WhiteListObjectInputStream)1 EOFException (java.io.EOFException)1