Class PoolUtils.KeyedPoolableObjectFactoryAdaptor<K,​V>

  • All Implemented Interfaces:
    KeyedPoolableObjectFactory<K,​V>
    Enclosing class:
    PoolUtils

    private static class PoolUtils.KeyedPoolableObjectFactoryAdaptor<K,​V>
    extends java.lang.Object
    implements KeyedPoolableObjectFactory<K,​V>
    Adaptor class that turns a PoolableObjectFactory into a KeyedPoolableObjectFactory by ignoring keys.
    • Constructor Detail

      • KeyedPoolableObjectFactoryAdaptor

        KeyedPoolableObjectFactoryAdaptor​(PoolableObjectFactory<V> factory)
                                   throws java.lang.IllegalArgumentException
        Create a new KeyedPoolableObjectFactoryAdaptor using the given PoolableObjectFactory to manage objects.
        Parameters:
        factory - wrapped PoolableObjectFactory
        Throws:
        java.lang.IllegalArgumentException - if the factory is null
    • Method Detail

      • makeObject

        public V makeObject​(K key)
                     throws java.lang.Exception
        Create a new object instance, ignoring the key
        Specified by:
        makeObject in interface KeyedPoolableObjectFactory<K,​V>
        Parameters:
        key - ignored
        Returns:
        newly created object instance
        Throws:
        java.lang.Exception - if there is a problem creating a new instance, this will be propagated to the code requesting an object.
      • validateObject

        public boolean validateObject​(K key,
                                      V obj)
        Validate the object, ignoring the key
        Specified by:
        validateObject in interface KeyedPoolableObjectFactory<K,​V>
        Parameters:
        key - ignored
        obj - object to validate
        Returns:
        true if validation is successful
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object