org.apache.ojb.broker.core
Class PersistenceBrokerFactoryDefaultImpl

java.lang.Object
  extended byorg.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl
      extended byorg.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl
All Implemented Interfaces:
org.apache.ojb.broker.util.configuration.Configurable, PersistenceBrokerFactoryIF
Direct Known Subclasses:
PersistenceBrokerFactorySyncImpl

public class PersistenceBrokerFactoryDefaultImpl
extends PersistenceBrokerFactoryBaseImpl

This is the default implementation of the PersistenceBrokerFactoryIF interface.

This implementation use a pool of PersistenceBroker instances [abbr. PB]. Each pooled PB instance (the implementation class was specified in OJB configuration file) is wrapped by PoolablePersistenceBroker class before add to pool.

When calling createPersistenceBroker(org.apache.ojb.broker.PBKey) or PersistenceBrokerFactoryBaseImpl.defaultPersistenceBroker() the pooled-PB instance (PoolablePersistenceBroker) on its part was wrapped with PersistenceBrokerHandle handle.

When a client do a PB.close() call on the handle the wrapped PoolablePersistenceBroker will be closed and returned to pool. All further method calls on the handle (except PB.isClosed() and PB.isInTransaction()) result in an exception.

Each different PBKey (based on PBKey.equals(...) method) get its own PB-pool.

Version:
$Id: PersistenceBrokerFactoryDefaultImpl.java,v 1.11 2004/05/31 23:23:06 arminw Exp $
Author:
Thomas Mahler, Armin Waibel
See Also:
PersistenceBrokerFactoryBaseImpl

Constructor Summary
PersistenceBrokerFactoryDefaultImpl()
           
 
Method Summary
 int activePersistenceBroker()
          Not implemented!
 PersistenceBroker createPersistenceBroker(PBKey pbKey)
          Return broker instance from pool.
 java.util.Properties getPoolConfiguration()
          could be used for monitoring TODO: is this useful?
 void releaseAllInstances()
          release all broker instances pooled by the factory.
 void setPoolConfiguration(java.util.Properties prop)
          could be used for runtime configuration TODO: is this useful?
 
Methods inherited from class org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl
configure, createPersistenceBroker, defaultPersistenceBroker, getDefaultKey, setDefaultKey
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceBrokerFactoryDefaultImpl

public PersistenceBrokerFactoryDefaultImpl()
Method Detail

createPersistenceBroker

public PersistenceBroker createPersistenceBroker(PBKey pbKey)
                                          throws PBFactoryException
Return broker instance from pool. If given PBKey was not found in pool a new pool for given

Specified by:
createPersistenceBroker in interface PersistenceBrokerFactoryIF
Overrides:
createPersistenceBroker in class PersistenceBrokerFactoryBaseImpl
Parameters:
pbKey -
Returns:
Throws:
PBFactoryException

releaseAllInstances

public void releaseAllInstances()
Description copied from interface: PersistenceBrokerFactoryIF
release all broker instances pooled by the factory. each broker instance is closed before release.

Specified by:
releaseAllInstances in interface PersistenceBrokerFactoryIF
Overrides:
releaseAllInstances in class PersistenceBrokerFactoryBaseImpl
See Also:
PersistenceBrokerFactoryIF.releaseAllInstances()

activePersistenceBroker

public int activePersistenceBroker()
Description copied from class: PersistenceBrokerFactoryBaseImpl
Not implemented!

Specified by:
activePersistenceBroker in interface PersistenceBrokerFactoryIF
Overrides:
activePersistenceBroker in class PersistenceBrokerFactoryBaseImpl
Returns:
always 0

getPoolConfiguration

public java.util.Properties getPoolConfiguration()
could be used for monitoring TODO: is this useful?


setPoolConfiguration

public void setPoolConfiguration(java.util.Properties prop)
could be used for runtime configuration TODO: is this useful?



(C) 2002 - 2004 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.3, 2005-04-2