package org.apache.axis2.transport.rabbitmq;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.QueueingConsumer;

import java.io.IOException;
import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

public class RMQChannelPool {

    private BlockingDeque<RMQChannel> RMQChannelPool;

    public RMQChannelPool(RabbitMQConnectionFactory connectionFactory, int connectionPoolSize) {

        RMQChannelPool = new LinkedBlockingDeque<>();
        try {
            Connection connection = connectionFactory.createConnection();
            for (int i = 0; i < connectionPoolSize; i++) {
                com.rabbitmq.client.Channel channel = connection.createChannel();
                QueueingConsumer consumer = new QueueingConsumer(channel);
                String replyQueueName = channel.queueDeclare().getQueue();
                channel.basicConsume(replyQueueName, false, consumer);
                RMQChannelPool.add(new RMQChannel(connection, channel));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    public RMQChannel take() throws InterruptedException {
        return RMQChannelPool.take();
    }

    public void push(RMQChannel RMQChannel) {
        RMQChannelPool.push(RMQChannel);
    }

    public void clear() {
        RMQChannelPool.clear();
    }
}

@@ -89,44 +89,84 @@
 ort 
-com.rabbitmq.client.QueueingConsumer
+org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory
 ;%0A%0Ai
@@ -285,16 +285,17 @@
 Deque;%0A%0A
+%0A
 public c
@@ -313,24 +313,100 @@
 nnelPool %7B%0A%0A
+    private static final Log log = LogFactory.getLog(RMQChannelPool.class);%0A
     private 
@@ -833,229 +833,8 @@
 ();%0A
-                QueueingConsumer consumer = new QueueingConsumer(channel);%0A                String replyQueueName = channel.queueDeclare().getQueue();%0A                channel.basicConsume(replyQueueName, false, consumer);%0A
     
@@ -966,26 +966,67 @@
     
-e.printStackTrace(
+log.error(%22Exception occurred while creating connection%22, e
 );%0A 

Fix for the ESBJAVA-4785