db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r521383 - in /db/ojb/branches/OJB_1_0_RELEASE/src: java/org/apache/ojb/broker/accesslayer/ java/org/apache/ojb/broker/core/ java/org/apache/ojb/jdo/ java/org/apache/ojb/odmg/oql/ java/org/apache/ojb/otm/core/ java/org/apache/ojb/soda/ test/...
Date Thu, 22 Mar 2007 18:01:33 GMT
Author: arminw
Date: Thu Mar 22 11:01:32 2007
New Revision: 521383

URL: http://svn.apache.org/viewvc?view=rev&rev=521383
Log:
rename (deprecate) method OJBIterator.releaseDbResources() to OJBIterator.close()

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ChainingIterator.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/OJBIterator.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/PagingIterator.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/jdo/ExtentImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/otm/core/BaseConnection.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/soda/ObjectSetImpl.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/RsIteratorTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataMultithreadedTest.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ChainingIterator.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ChainingIterator.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ChainingIterator.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/ChainingIterator.java
Thu Mar 22 11:01:32 2007
@@ -367,10 +367,15 @@
      */
     public void releaseDbResources()
     {
+        close();
+    }
+
+    public void close()
+    {
         Iterator it = m_rsIterators.iterator();
         while (it.hasNext())
         {
-            ((OJBIterator) it.next()).releaseDbResources();
+            ((OJBIterator) it.next()).close();
         }
     }
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/OJBIterator.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/OJBIterator.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/OJBIterator.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/OJBIterator.java
Thu Mar 22 11:01:32 2007
@@ -20,7 +20,7 @@
 import org.apache.ojb.broker.PersistenceBrokerException;
 
 /**
- * A {@link Iterator} extension internaly used by OJB to handle query results.
+ * A {@link Iterator} extension internally used by OJB to handle query results.
  *
  * <p>
  * NOTE: OJB is very strict in handling <tt>OJBIterator</tt> instances. <tt>OJBIterator</tt>
is
@@ -83,14 +83,36 @@
     boolean relative(int row) throws PersistenceBrokerException;
 
     /**
-     * Release all internally used Database resources of the iterator.
-     * Clients must call this methods explicitely if the iterator is not
-     * exhausted by the client application. If the Iterator is exhauseted
-     * this method will be called implicitely.
+     * Release all internally used database resources of this iterator.
+     * Clients must call this method explicitly for <strong>immediate release of resources</strong>
+     * if the iterator is not exhausted by the client, else the resources will be
+     * released on {@link org.apache.ojb.broker.PersistenceBroker#close PB.close()},
+     * {@link org.apache.ojb.broker.PersistenceBroker#commitTransaction PB.commitTransaction()}
+     * or {@link org.apache.ojb.broker.PersistenceBroker#abortTransaction() PB.abortTransaction()}.
+     * <p>
+     * If the Iterator is exhauseted this method will be called implicit after return of
the
+     * last iterator object.
+     * </p>
+     *
+     * @deprecated please use {@link #close()}
      */
     public void releaseDbResources();
 
     /**
+     * Release all internally used database resources of this iterator.
+     * Clients must call this method explicitly for <strong>immediate release of resources</strong>
+     * if the iterator is not exhausted by the client, else the resources will be
+     * released on {@link org.apache.ojb.broker.PersistenceBroker#close PB.close()},
+     * {@link org.apache.ojb.broker.PersistenceBroker#commitTransaction PB.commitTransaction()}
+     * or {@link org.apache.ojb.broker.PersistenceBroker#abortTransaction() PB.abortTransaction()}.
+     * <p>
+     * If the Iterator is exhauseted this method will be called implicit after return of
the
+     * last iterator object.
+     * </p>
+     */
+    public void close();
+
+    /**
      * Do not fire any PBLifeCycleEvent when reading next item.
      */
     public void disableLifeCycleEvents();
@@ -119,6 +141,10 @@
         }
 
         public void releaseDbResources()
+        {
+        }
+
+        public void close()
         {
         }
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/PagingIterator.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/PagingIterator.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/PagingIterator.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/PagingIterator.java
Thu Mar 22 11:01:32 2007
@@ -67,7 +67,7 @@
             m_iterator = OJBIterator.EMPTY_ITERATOR;
             m_rowLimitSize = 0;
             m_fullSize = 0;
-            anIterator.releaseDbResources();
+            anIterator.close();
         }
         else
         {
@@ -159,7 +159,12 @@
 	 */
     public void releaseDbResources()
     {
-        m_iterator.releaseDbResources();
+        close();
+    }
+
+    public void close()
+    {
+        m_iterator.close();
     }
 
     /**
@@ -178,7 +183,7 @@
         boolean result = m_currentCursorPosition <= m_endAt && m_iterator.hasNext();
         if(!result)
         {
-            releaseDbResources();
+            close();
         }
         return result;
     }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
Thu Mar 22 11:01:32 2007
@@ -845,17 +845,16 @@
         return retval;
     }
 
-    /**
-     * Release all internally used Database resources of the iterator. Clients
-     * must call this methods explicitely if the iterator is not exhausted by
-     * the client application. If the Iterator is exhauseted this method will
-     * be called implicitely.
-     */
     public void releaseDbResources()
     {
         release(true);
     }
 
+    public void close()
+    {
+        release(true);
+    }
+
     void release(boolean removeResourceListener)
     {
         if (!isInBatchedMode()) // resources are reused in batched mode
@@ -898,7 +897,7 @@
     {
         if(autoRelease)
         {
-            releaseDbResources();
+            close();
         }
     }
 
@@ -952,7 +951,7 @@
         {
             logger.info("Found unclosed resources while finalize (causer class: " + this.getClass().getName()
+ ")" +
                     " Do automatic cleanup");
-            releaseDbResources();
+            close();
         }
         try
         {

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
Thu Mar 22 11:01:32 2007
@@ -1886,7 +1886,7 @@
             } // make sure that we close the used resources
             finally
             {
-                if(it != null) it.releaseDbResources();
+                if(it != null) it.close();
             }
         }
         return result;
@@ -2145,7 +2145,7 @@
         {
             if (iter instanceof OJBIterator)
             {
-                ((OJBIterator) iter).releaseDbResources();
+                ((OJBIterator) iter).close();
             }
         }
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
Thu Mar 22 11:01:32 2007
@@ -226,7 +226,7 @@
         {
             if (iter != null)
             {
-                iter.releaseDbResources();
+                iter.close();
             }
             if (isRetrievalTasksCreated)
             {

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/jdo/ExtentImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/jdo/ExtentImpl.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/jdo/ExtentImpl.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/jdo/ExtentImpl.java Thu Mar 22
11:01:32 2007
@@ -142,7 +142,7 @@
 
         private void close()
         {
-            itty.releaseDbResources();
+            itty.close();
             closed = true;
         }
     }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/oql/OQLQueryImpl.java Thu
Mar 22 11:01:32 2007
@@ -294,7 +294,7 @@
                 {
                     if (iter instanceof OJBIterator)
                     {
-                        ((OJBIterator) iter).releaseDbResources();
+                        ((OJBIterator) iter).close();
                     }
                 }
             }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/otm/core/BaseConnection.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/otm/core/BaseConnection.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/otm/core/BaseConnection.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/otm/core/BaseConnection.java Thu
Mar 22 11:01:32 2007
@@ -587,7 +587,12 @@
          */
         public void releaseDbResources()
         {
-            _it.releaseDbResources();
+            close();
+        }
+
+        public void close()
+        {
+            _it.close();
         }
 
         /*

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/soda/ObjectSetImpl.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/soda/ObjectSetImpl.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/soda/ObjectSetImpl.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/soda/ObjectSetImpl.java Thu Mar
22 11:01:32 2007
@@ -101,7 +101,7 @@
         {
             if (ojbIterator instanceof RsIterator)
             {
-                ((RsIterator) ojbIterator).releaseDbResources();
+                ((RsIterator) ojbIterator).close();
             }
             setResultSetClosed(true);
         }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PaginationTest.java Thu
Mar 22 11:01:32 2007
@@ -515,7 +515,7 @@
                 }
             }
             // manually release used resources
-            ojbIterator.releaseDbResources();
+            ojbIterator.close();
 
 
             // -------------------------------------------------------------
@@ -561,7 +561,7 @@
                 }
             }
             // manually release used resources
-            ojbIterator.releaseDbResources();
+            ojbIterator.close();
 
 
             // -------------------------------------------------------------
@@ -606,7 +606,7 @@
                 }
             }
             // manually release used resources
-            ojbIterator.releaseDbResources();
+            ojbIterator.close();
 
 
             // -------------------------------------------------------------
@@ -653,7 +653,7 @@
                 }
             }
             // manually release used resources
-            ojbIterator.releaseDbResources();
+            ojbIterator.close();
         }
         finally
         {
@@ -861,7 +861,7 @@
         query.setEndAtIndex(fullSize + 14);
         ojbIter = (OJBIterator) broker.getIteratorByQuery(query);
         assertEquals("indices out of range expecting 0 rows", 0,ojbIter.size());
-        ojbIter.releaseDbResources();
+        ojbIter.close();
     }
 
     public void testPagingEndIndexOutOfRange()
@@ -887,7 +887,7 @@
         query.setEndAtIndex(fullSize + 9);
         ojbIter = (OJBIterator)broker.getIteratorByQuery(query);
         assertEquals("end index out of range expecting 10 rows", 10,ojbIter.size());
-        ojbIter.releaseDbResources();
+        ojbIter.close();
     }
 
     public void testPagingEmptyIterator()
@@ -913,7 +913,7 @@
         query.setEndAtIndex(14);
         ojbIter = (OJBIterator)broker.getIteratorByQuery(query);
         assertEquals("index 10 - 14 expecting 0 rows for empty iterator", 0,ojbIter.size());
-        ojbIter.releaseDbResources();
+        ojbIter.close();
     }
 
     private Article createArticle(ProductGroup group, String name)

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/PersistenceBrokerTest.java
Thu Mar 22 11:01:32 2007
@@ -928,7 +928,7 @@
         OJBIterator ojbIter = (OJBIterator)broker.getIteratorByQuery(query);
         assertEquals("size of iterator should be one", 1, ojbIter.size());
         InterfaceArticle test4 = (InterfaceArticle) ojbIter.next();
-        ojbIter.releaseDbResources();
+        ojbIter.close();
         assertTrue("Id should be a number of the generated articles", range.containsInteger(test4.getArticleId()));
     }
 
@@ -1516,6 +1516,6 @@
         iterSize = ojbIter.size();
 
         assertEquals("collSize == iterSize", collSize , iterSize);
-        ojbIter.releaseDbResources();
+        ojbIter.close();
     }
 }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/RsIteratorTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/RsIteratorTest.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/RsIteratorTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/RsIteratorTest.java Thu
Mar 22 11:01:32 2007
@@ -364,7 +364,7 @@
         }
 
         // TODO: Remove this cast one day
-        ((RsIterator) it).releaseDbResources();
+        ((RsIterator) it).close();
     }
 
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataMultithreadedTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataMultithreadedTest.java?view=diff&rev=521383&r1=521382&r2=521383
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataMultithreadedTest.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/metadata/MetadataMultithreadedTest.java
Thu Mar 22 11:01:32 2007
@@ -119,7 +119,7 @@
                 System.err.println("------");
             }
             assertNotNull("Should get metadata exception from proxy", expectedThrowable);
-            ((OJBIterator) groupIter).releaseDbResources();
+            ((OJBIterator) groupIter).close();
 
             // Load the repository profile and re-try loading.
             broker.clearCache();



---------------------------------------------------------------------
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