db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olegn...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/batch BatchConnection.java
Date Thu, 27 Mar 2003 06:13:22 GMT
olegnitz    2003/03/26 22:13:21

  Modified:    src/java/org/apache/ojb/broker/util/batch
                        BatchConnection.java
  Log:
  Fixed OutOfMemoryError for huge transactions
  
  Revision  Changes    Path
  1.9       +13 -2     db-ojb/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java
  
  Index: BatchConnection.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/batch/BatchConnection.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BatchConnection.java	16 Feb 2003 17:28:53 -0000	1.8
  +++ BatchConnection.java	27 Mar 2003 06:13:21 -0000	1.9
  @@ -89,6 +89,8 @@
    */
   public class BatchConnection extends WrappedConnection
   {
  +    private static final int MAX_COUNT = 1000;
  +
       /**
        * Maps PBKey to another HashMap,
        * which maps table name to List of related tables (N:1 or 1:1)
  @@ -101,6 +103,7 @@
       private HashMap _fkInfo;
       private HashSet _deleted;
       private HashSet _dontInsert;
  +    private int count = 0;
   
       public BatchConnection(Connection conn, PersistenceBroker broker)
       {
  @@ -152,7 +155,15 @@
        */
       void nextExecuted(String sql) throws SQLException
       {
  -        if (_order.contains(sql)) {
  +        count++;
  +        if (count == MAX_COUNT)
  +        {
  +            executeBatch();
  +            count = 0;
  +        }
  +
  +        if (_order.contains(sql))
  +        {
               return;
           }
   
  
  
  

Mime
View raw message