org.apache.ojb.broker.core
Class PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory

java.lang.Object
  extended byorg.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory
All Implemented Interfaces:
org.apache.commons.pool.KeyedPoolableObjectFactory
Enclosing class:
PersistenceBrokerFactoryDefaultImpl

class PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory
extends java.lang.Object
implements org.apache.commons.pool.KeyedPoolableObjectFactory

This is a KeyedPoolableObjectFactory implementation, manage the life-cycle of PersistenceBroker instances hold in an KeyedObjectPool.

Author:
Armin Waibel

Constructor Summary
PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory(PersistenceBrokerFactoryDefaultImpl pbf, org.apache.commons.pool.KeyedObjectPool pool)
           
 
Method Summary
 void activateObject(java.lang.Object key, java.lang.Object obj)
          Called before borrow object from pool.
 void destroyObject(java.lang.Object key, java.lang.Object obj)
          Do all cleanup stuff here.
 java.lang.Object makeObject(java.lang.Object key)
           
 void passivateObject(java.lang.Object key, java.lang.Object obj)
          Called before return object to pool.
 boolean validateObject(java.lang.Object key, java.lang.Object obj)
          Check if the given PersistenceBroker instance was already in transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory

public PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory(PersistenceBrokerFactoryDefaultImpl pbf,
                                                                        org.apache.commons.pool.KeyedObjectPool pool)
Method Detail

makeObject

public java.lang.Object makeObject(java.lang.Object key)
                            throws java.lang.Exception
Specified by:
makeObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory
Throws:
java.lang.Exception

destroyObject

public void destroyObject(java.lang.Object key,
                          java.lang.Object obj)
                   throws java.lang.Exception
Do all cleanup stuff here.

Specified by:
destroyObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory
Throws:
java.lang.Exception

validateObject

public boolean validateObject(java.lang.Object key,
                              java.lang.Object obj)
Check if the given PersistenceBroker instance was already in transaction. Was called when PBPoolInfo.init() method does set testOnBorrow(true). (Default was false, thus this method wasn't called) See documentation jakarta-connons-pool api.

Specified by:
validateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory

activateObject

public void activateObject(java.lang.Object key,
                           java.lang.Object obj)
                    throws java.lang.Exception
Called before borrow object from pool.

Specified by:
activateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory
Throws:
java.lang.Exception

passivateObject

public void passivateObject(java.lang.Object key,
                            java.lang.Object obj)
                     throws java.lang.Exception
Called before return object to pool.

Specified by:
passivateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactory
Throws:
java.lang.Exception


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14