db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/core PersistenceBrokerHandle.java
Date Sun, 31 Aug 2003 00:59:45 GMT
arminw      2003/08/30 17:59:45

  Modified:    src/java/org/apache/ojb/broker/core
                        PersistenceBrokerHandle.java
  Log:
  minor changes, use finally block to
  destroy handle
  
  Revision  Changes    Path
  1.5       +23 -15    db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerHandle.java
  
  Index: PersistenceBrokerHandle.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerHandle.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PersistenceBrokerHandle.java	11 Aug 2003 13:43:42 -0000	1.4
  +++ PersistenceBrokerHandle.java	31 Aug 2003 00:59:44 -0000	1.5
  @@ -19,8 +19,10 @@
   
       public boolean isClosed()
       {
  -        if(getDelegate() == null) return true;
  -        else return super.isClosed();
  +        if (getDelegate() == null)
  +            return true;
  +        else
  +            return super.isClosed();
       }
   
       public boolean isInTransaction() throws PersistenceBrokerException
  @@ -30,20 +32,26 @@
   
       /**
        * Destroy this handle and return the underlying (wrapped) PB instance
  -     * to pool (when using default implementation of PersistenceBrokerFactory).
  +     * to pool (when using default implementation of PersistenceBrokerFactory),
  +     * unset this instance from {@link PersistenceBrokerThreadMapping}.
        */
       public boolean close()
       {
  -        if(getDelegate() == null) return true;
  -
  -        PersistenceBrokerThreadMapping.unsetCurrentPersistenceBroker(getPBKey(), this);
  -        super.close();
  -        /*
  -        here we destroy the handle. set the
  -        underlying PB instance 'null', thus it's not
  -        possible to corrupt a closed PB instance.
  -        */
  -        setDelegate(null);
  -        return true;
  +        if (getDelegate() == null) return true;
  +        try
  +        {
  +            PersistenceBrokerThreadMapping.unsetCurrentPersistenceBroker(getPBKey(), this);
  +            super.close();
  +        }
  +        finally
  +        {
  +            /*
  +            here we destroy the handle. set the
  +            underlying PB instance 'null', thus it's not
  +            possible to corrupt a closed PB instance.
  +            */
  +            setDelegate(null);
  +            return true;
  +        }
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message