You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2010/03/25 03:28:25 UTC

svn commit: r927256 - /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java

Author: hansbak
Date: Thu Mar 25 02:28:25 2010
New Revision: 927256

URL: http://svn.apache.org/viewvc?rev=927256&view=rev
Log:
when exporting all data, an error message in the log advices to put the the function in a transaction. also added extra commits to try to solve the permgen problem. it is better now, but not solved completely

Modified:
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=927256&r1=927255&r2=927256&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Thu Mar 25 02:28:25 2010
@@ -77,6 +77,7 @@ import org.ofbiz.entity.util.EntityDataL
 import org.ofbiz.entity.util.EntityListIterator;
 import org.ofbiz.entity.util.EntitySaxReader;
 import org.ofbiz.entityext.EntityGroupUtil;
+import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.security.Security;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.LocalDispatcher;
@@ -508,6 +509,7 @@ public class WebToolsServices {
                             continue;
                         }
 
+                        TransactionUtil.begin();
                         // some databases don't support cursors, or other problems may happen, so if there is an error here log it and move on to get as much as possible
                         try {
                             values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), null);
@@ -527,6 +529,10 @@ public class WebToolsServices {
                             do {
                                 value.writeXmlText(writer, "");
                                 numberWritten++;
+                                if (numberWritten % 500 == 0) {
+                                    TransactionUtil.commit();
+                                    TransactionUtil.begin();
+                                }
                             } while ((value = (GenericValue) values.next()) != null);
                             writer.println("</entity-engine-xml>");
                             writer.close();
@@ -535,6 +541,7 @@ public class WebToolsServices {
                             results.add("["+fileNumber +"] [---] " + curEntityName + " has no records, not writing file");
                         }
                         values.close();
+                        TransactionUtil.commit();
                     } catch (Exception ex) {
                         if (values != null) {
                             try {



Re: svn commit: r927256 - /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java

Posted by Adam Heath <do...@brainfood.com>.
hansbak@apache.org wrote:
> Author: hansbak
> Date: Thu Mar 25 02:28:25 2010
> New Revision: 927256
> 
> URL: http://svn.apache.org/viewvc?rev=927256&view=rev
> Log:
> when exporting all data, an error message in the log advices to put the the function in a transaction. also added extra commits to try to solve the permgen problem. it is better now, but not solved completely
> 
> Modified:
>     ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
> 
> Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java?rev=927256&r1=927255&r2=927256&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (original)
> +++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java Thu Mar 25 02:28:25 2010
> @@ -77,6 +77,7 @@ import org.ofbiz.entity.util.EntityDataL
>  import org.ofbiz.entity.util.EntityListIterator;
>  import org.ofbiz.entity.util.EntitySaxReader;
>  import org.ofbiz.entityext.EntityGroupUtil;
> +import org.ofbiz.entity.transaction.TransactionUtil;
>  import org.ofbiz.security.Security;
>  import org.ofbiz.service.DispatchContext;
>  import org.ofbiz.service.LocalDispatcher;
> @@ -508,6 +509,7 @@ public class WebToolsServices {
>                              continue;
>                          }
>  
> +                        TransactionUtil.begin();
>                          // some databases don't support cursors, or other problems may happen, so if there is an error here log it and move on to get as much as possible
>                          try {
>                              values = delegator.find(curEntityName, null, null, null, me.getPkFieldNames(), null);
> @@ -527,6 +529,10 @@ public class WebToolsServices {
>                              do {
>                                  value.writeXmlText(writer, "");
>                                  numberWritten++;
> +                                if (numberWritten % 500 == 0) {
> +                                    TransactionUtil.commit();
> +                                    TransactionUtil.begin();
> +                                }
>                              } while ((value = (GenericValue) values.next()) != null);
>                              writer.println("</entity-engine-xml>");
>                              writer.close();
> @@ -535,6 +541,7 @@ public class WebToolsServices {
>                              results.add("["+fileNumber +"] [---] " + curEntityName + " has no records, not writing file");
>                          }
>                          values.close();
> +                        TransactionUtil.commit();
>                      } catch (Exception ex) {
>                          if (values != null) {
>                              try {
> 

Bad transaction pattern.  boolean beganTx = TransactionUtil.begin();