Class RabbitMQChannelFactory

java.lang.Object
org.apache.commons.pool2.BaseObject
org.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
edu.ucsb.nceas.metacat.index.queue.pool.RabbitMQChannelFactory
All Implemented Interfaces:
org.apache.commons.pool2.PooledObjectFactory<com.rabbitmq.client.Channel>

public class RabbitMQChannelFactory extends org.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
This factory is used to create the RabbitMQ channels in the channel pool.
Author:
Tao
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    com.rabbitmq.client.Channel
     
    void
    destroyObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject)
     
    int
    Get the negotiated maximum channel number.
    Get the host name of the rabbitmq service
    int
    Get the port number of the rabbitmq service
    boolean
    validateObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject)
     
    org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel>
    wrap(com.rabbitmq.client.Channel channel)
     

    Methods inherited from class org.apache.commons.pool2.BasePooledObjectFactory

    activateObject, makeObject, passivateObject

    Methods inherited from class org.apache.commons.pool2.BaseObject

    toString, toStringAppendFields

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.commons.pool2.PooledObjectFactory

    destroyObject
  • Field Details

  • Constructor Details

  • Method Details

    • destroyObject

      public void destroyObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject) throws IOException, TimeoutException
      Specified by:
      destroyObject in interface org.apache.commons.pool2.PooledObjectFactory<com.rabbitmq.client.Channel>
      Overrides:
      destroyObject in class org.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
      Throws:
      IOException
      TimeoutException
    • validateObject

      public boolean validateObject(org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> pooledObject)
      Specified by:
      validateObject in interface org.apache.commons.pool2.PooledObjectFactory<com.rabbitmq.client.Channel>
      Overrides:
      validateObject in class org.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
    • create

      public com.rabbitmq.client.Channel create() throws IOException, TimeoutException
      Specified by:
      create in class org.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
      Throws:
      IOException
      TimeoutException
    • wrap

      public org.apache.commons.pool2.PooledObject<com.rabbitmq.client.Channel> wrap(com.rabbitmq.client.Channel channel)
      Specified by:
      wrap in class org.apache.commons.pool2.BasePooledObjectFactory<com.rabbitmq.client.Channel>
    • getChannelMax

      public int getChannelMax() throws IOException, TimeoutException
      Get the negotiated maximum channel number.
      Returns:
      the maximum channel number permitted for this connection
      Throws:
      IOException
      TimeoutException
    • getRabbitMQhost

      public String getRabbitMQhost()
      Get the host name of the rabbitmq service
      Returns:
      the host name of the rabbitmq service
    • getRabbitMQport

      public int getRabbitMQport()
      Get the port number of the rabbitmq service
      Returns:
      the port number of the rabbitmq service