org.apache.ojb.broker.core
Class PersistenceBrokerFactorySyncImpl

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

public class PersistenceBrokerFactorySyncImpl
extends PersistenceBrokerFactoryDefaultImpl

Workaround for participate the PB-api in JTA transaction by implementing the Synchronization interface.
This may will be deprecated when we implemented a full JCA compliant connector.
When a new PersistenceBroker instance is created in method wrapBrokerWithPoolingHandle(org.apache.ojb.broker.PersistenceBrokerInternal, org.apache.commons.pool.KeyedObjectPool) the given PB instance is wrapped with PersistenceBrokerFactorySyncImpl.PersistenceBrokerSyncImpl before it was put to the PB-pool. When a PB instance was requested class try to lookup the current JTA transaction in wrapRequestedBrokerInstance(org.apache.ojb.broker.PersistenceBrokerInternal) before the pooled PB instance was wrapped with the PB handle. If a running tx was found the PB instance was registered with the transaction using the Synchronization interface.

Version:
$Id: PersistenceBrokerFactorySyncImpl.java 365232 2005-12-21 22:36:07Z tomdz $
Author:
Armin Waibel

Nested Class Summary
static class PersistenceBrokerFactorySyncImpl.PersistenceBrokerSyncImpl
           
 
Constructor Summary
PersistenceBrokerFactorySyncImpl()
           
 
Method Summary
 PersistenceBrokerInternal createPersistenceBroker(PBKey pbKey)
          Return broker instance from pool.
 
Methods inherited from class org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl
activePersistenceBroker, getPoolConfiguration, releaseAllInstances, setPoolConfiguration, shutdown
 
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

PersistenceBrokerFactorySyncImpl

public PersistenceBrokerFactorySyncImpl()
Method Detail

createPersistenceBroker

public PersistenceBrokerInternal createPersistenceBroker(PBKey pbKey)
                                                  throws PBFactoryException
Description copied from class: PersistenceBrokerFactoryDefaultImpl
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 PersistenceBrokerFactoryDefaultImpl
Throws:
PBFactoryException


(C) 2002 - 2006 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