Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.pool
Class BaseKeyedPoolableObjectFactory

    java.lang.Object
      org.apache.commons.pool.BaseKeyedPoolableObjectFactory

All Implemented Interfaces:
  KeyedPoolableObjectFactory

    public abstract class BaseKeyedPoolableObjectFactory

extends Object
implements KeyedPoolableObjectFactory

A base implementation of `KeyedPoolableObjectFactory`.

All operations defined here are essentially no-op's.

Since:
  Pool 1.0
Version:
  $Revision: 791907 $ $Date: 2009-07-07 09:56:33 -0700 (Tue, 07 Jul 2009) $
Author:
  Rodney Waldhoff
See Also:
  `KeyedPoolableObjectFactory`

Constructor Summary
`BaseKeyedPoolableObjectFactory()`

Method Summary
`void` | `activateObject(Object key, Object obj)` Reinitialize an instance to be returned by the pool.
`void` | `destroyObject(Object key, Object obj)` Destroy an instance no longer needed by the pool.
`abstract Object` | `makeObject(Object key)` Create an instance that can be served by the pool.
`void` | `passivateObject(Object key, Object obj)` Uninitialize an instance to be returned to the idle object pool.
`boolean` | `validateObject(Object key, Object obj)` Ensures that the instance is safe to be returned by the pool.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BaseKeyedPoolableObjectFactory

    public BaseKeyedPoolableObjectFactory()

Method Detail

### makeObject

    public abstract Object makeObject(Object key)
                               throws Exception

  Create an instance that can be served by the pool.

  Specified by:
    `makeObject` in interface `KeyedPoolableObjectFactory`
  Parameters:
    `key` - the key used when constructing the object
  Returns:
    an instance that can be served by the pool
  Throws:
    `Exception` - if there is a problem creating a new instance, this will be propagated to the code requesting an object.

### destroyObject

    public void destroyObject(Object key,
                              Object obj)
                       throws Exception

  Destroy an instance no longer needed by the pool.

  The default implementation is a no-op.

  Specified by:
    `destroyObject` in interface `KeyedPoolableObjectFactory`
  Parameters:
    `key` - the key used when selecting the instance
    `obj` - the instance to be destroyed
  Throws:
    `Exception` - should be avoided as it may be swallowed by the pool implementation.
  See Also:
    `KeyedPoolableObjectFactory.validateObject(java.lang.Object, java.lang.Object)`, `KeyedObjectPool.invalidateObject(java.lang.Object, java.lang.Object)`

### validateObject

    public boolean validateObject(Object key,
                                  Object obj)

  Ensures that the instance is safe to be returned by the pool.

  The default implementation always returns `true`.

  Specified by:
    `validateObject` in interface `KeyedPoolableObjectFactory`
  Parameters:
    `key` - the key used when selecting the object
    `obj` - the instance to be validated
  Returns:
    always `true` in the default implementation

### activateObject

    public void activateObject(Object key,
                               Object obj)
                        throws Exception

  Reinitialize an instance to be returned by the pool.

  The default implementation is a no-op.

  Specified by:
    `activateObject` in interface `KeyedPoolableObjectFactory`
  Parameters:
    `key` - the key used when selecting the object
    `obj` - the instance to be activated
  Throws:
    `Exception` - if there is a problem activating `obj`, this exception may be swallowed by the pool.
  See Also:
    `KeyedPoolableObjectFactory.destroyObject(java.lang.Object, java.lang.Object)`

### passivateObject

    public void passivateObject(Object key,
                                Object obj)
                         throws Exception

  Uninitialize an instance to be returned to the idle object pool.

  The default implementation is a no-op.

  Specified by:
    `passivateObject` in interface `KeyedPoolableObjectFactory`
  Parameters:
    `key` - the key used when selecting the object
    `obj` - the instance to be passivated
  Throws:
    `Exception` - if there is a problem passivating `obj`, this exception may be swallowed by the pool.
  See Also:
    `KeyedPoolableObjectFactory.destroyObject(java.lang.Object, java.lang.Object)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.