public class PersistenceBrokerFactoryDefaultImpl extends PersistenceBrokerFactoryBaseImpl
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 differentPBKey (based on PBKey.equals(...) method)
get its own PB-pool.PersistenceBrokerFactoryBaseImpl| Constructor and Description |
|---|
PersistenceBrokerFactoryDefaultImpl() |
| Modifier and Type | Method and Description |
|---|---|
int |
activePersistenceBroker()
Not implemented!
|
PersistenceBrokerInternal |
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?
|
void |
shutdown()
Shutdown method for OJB, kills all running processes within OJB - after
shutdown OJB can no longer be used.
|
configure, createPersistenceBroker, defaultPersistenceBroker, getDefaultKey, setDefaultKeypublic PersistenceBrokerInternal createPersistenceBroker(PBKey pbKey) throws PBFactoryException
PBKey was not found in pool
a new pool for givencreatePersistenceBroker in interface PersistenceBrokerFactoryIFcreatePersistenceBroker in class PersistenceBrokerFactoryBaseImplpbKey - PBFactoryExceptionpublic void releaseAllInstances()
PersistenceBrokerFactoryIFreleaseAllInstances in interface PersistenceBrokerFactoryIFreleaseAllInstances in class PersistenceBrokerFactoryBaseImplPersistenceBrokerFactoryIF.releaseAllInstances()public void shutdown()
PersistenceBrokerFactoryIFThreadLocal instances in OJB source and the reuse of threads
by the container (e.g. servlet- or ejb-container).shutdown in interface PersistenceBrokerFactoryIFshutdown in class PersistenceBrokerFactoryBaseImplpublic int activePersistenceBroker()
PersistenceBrokerFactoryBaseImplactivePersistenceBroker in interface PersistenceBrokerFactoryIFactivePersistenceBroker in class PersistenceBrokerFactoryBaseImplpublic java.util.Properties getPoolConfiguration()
public void setPoolConfiguration(java.util.Properties prop)
(C) 2002 - 2005 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30