|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl
org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl
public class PersistenceBrokerFactoryDefaultImpl
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 differentPBKey (based on PBKey.equals(...) method)
get its own PB-pool.
PersistenceBrokerFactoryBaseImpl| Constructor Summary | |
|---|---|
PersistenceBrokerFactoryDefaultImpl()
|
|
| Method Summary | |
|---|---|
int |
activePersistenceBroker()
Not implemented! |
PersistenceBrokerInternal |
createPersistenceBroker(PBKey pbKey)
Return broker instance from pool. |
Properties |
getPoolConfiguration()
could be used for monitoring TODO: is this useful? |
void |
releaseAllInstances()
release all broker instances pooled by the factory. |
void |
setPoolConfiguration(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. |
protected PersistenceBrokerInternal |
wrapBrokerWithPoolingHandle(PersistenceBrokerInternal broker,
org.apache.commons.pool.KeyedObjectPool pool)
Each real pooled PersistenceBroker instance was wrapped by a
pooling handle when a new instance was created. |
protected PersistenceBrokerInternal |
wrapRequestedBrokerInstance(PersistenceBrokerInternal broker)
Wraps the requested pooled broker instance. |
| Methods inherited from class org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl |
|---|
configure, createNewBrokerInstance, createPersistenceBroker, defaultPersistenceBroker, getDefaultKey, setDefaultKey |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PersistenceBrokerFactoryDefaultImpl()
| Method Detail |
|---|
public PersistenceBrokerInternal createPersistenceBroker(PBKey pbKey)
throws PBFactoryException
PBKey was not found in pool
a new pool for given
createPersistenceBroker in interface PersistenceBrokerFactoryIFcreatePersistenceBroker in class PersistenceBrokerFactoryBaseImplpbKey -
PBFactoryException
protected PersistenceBrokerInternal wrapBrokerWithPoolingHandle(PersistenceBrokerInternal broker,
org.apache.commons.pool.KeyedObjectPool pool)
PersistenceBroker instance was wrapped by a
pooling handle when a new instance was created.
broker - real PersistenceBroker instancepool - use KeyedObjectPool
PoolablePersistenceBrokerprotected PersistenceBrokerInternal wrapRequestedBrokerInstance(PersistenceBrokerInternal broker)
broker -
PersistenceBrokerHandlepublic void releaseAllInstances()
PersistenceBrokerFactoryIF
releaseAllInstances 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()
PersistenceBrokerFactoryBaseImpl
activePersistenceBroker in interface PersistenceBrokerFactoryIFactivePersistenceBroker in class PersistenceBrokerFactoryBaseImplpublic Properties getPoolConfiguration()
public void setPoolConfiguration(Properties prop)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||