1 package org.apache.ojb.broker.core; 2 3 17 18 import org.apache.ojb.broker.PersistenceBrokerException; 19 import org.apache.ojb.broker.PersistenceBrokerInternal; 20 21 public class PersistenceBrokerHandle extends DelegatingPersistenceBroker 22 { 23 27 public PersistenceBrokerHandle(final PersistenceBrokerInternal broker) 28 { 29 super(broker); 30 PersistenceBrokerThreadMapping.setCurrentPersistenceBroker(broker.getPBKey(), this); 31 } 32 33 public boolean isClosed() 34 { 35 return super.isClosed(); 36 } 37 38 public boolean isInTransaction() throws PersistenceBrokerException 39 { 40 return !isClosed() && super.isInTransaction(); 41 } 42 43 48 public boolean close() 49 { 50 if (getDelegate() == null) return true; 51 try 52 { 53 PersistenceBrokerThreadMapping.unsetCurrentPersistenceBroker(getPBKey(), this); 54 super.close(); 55 } 56 finally 57 { 58 63 setDelegate(null); 64 } 65 return true; 66 } 67 } 68 | Popular Tags |