svn commit: r950278 - /ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r950278 - /ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java

doogie-3
Author: doogie
Date: Tue Jun  1 22:00:45 2010
New Revision: 950278

URL: http://svn.apache.org/viewvc?rev=950278&view=rev
Log:
Revert wrongly committed 950257

Modified:
    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java

Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=950278&r1=950277&r2=950278&view=diff
==============================================================================
--- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java (original)
+++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java Tue Jun  1 22:00:45 2010
@@ -24,15 +24,10 @@ import java.text.NumberFormat;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeSet;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-import java.util.concurrent.ScheduledExecutorService;
 import java.io.File;
 
 import javolution.util.FastList;
 
-import org.ofbiz.base.concurrent.ExecutionPool;
 import org.ofbiz.base.container.Container;
 import org.ofbiz.base.container.ContainerConfig;
 import org.ofbiz.base.container.ContainerException;
@@ -372,8 +367,8 @@ public class EntityDataLoadContainer imp
         changedFormat.setMinimumIntegerDigits(5);
         changedFormat.setGroupingUsed(false);
 
-        final List<Object> errorMessages = FastList.newInstance();
-        final List<String> infoMessages = FastList.newInstance();
+        List<Object> errorMessages = FastList.newInstance();
+        List<String> infoMessages = FastList.newInstance();
         int totalRowsChanged = 0;
         if (UtilValidate.isNotEmpty(urlList)) {
             Debug.logImportant("=-=-=-=-=-=-= Doing a data load with the following files:", module);
@@ -383,26 +378,15 @@ public class EntityDataLoadContainer imp
 
             Debug.logImportant("=-=-=-=-=-=-= Starting the data load...", module);
 
-            ScheduledExecutorService pool = ExecutionPool.getNewOptimalExecutor("entity-data-load");
-            List<Future> futures = FastList.newInstance();
             for (URL dataUrl: urlList) {
-                futures.add(pool.submit(createCallable(dataUrl, helperInfo.getHelperBaseName(), delegator, errorMessages, txTimeout, useDummyFks, maintainTxs, tryInserts)));
-            }
-            for (int i = 0; i < urlList.size(); i++) {
-                URL dataUrl = urlList.get(i);
-                Future<Integer> future = futures.get(i);
-
                 try {
-                    int rowsChanged = future.get();
+                    int rowsChanged = EntityDataLoader.loadData(dataUrl, helperInfo.getHelperBaseName(), delegator, errorMessages, txTimeout, useDummyFks, maintainTxs, tryInserts);
                     totalRowsChanged += rowsChanged;
                     infoMessages.add(changedFormat.format(rowsChanged) + " of " + changedFormat.format(totalRowsChanged) + " from " + dataUrl.toExternalForm());
-                } catch (ExecutionException e) {
-                    Debug.logError(e, "Error loading data file: " + dataUrl.toExternalForm(), module);
-                } catch (InterruptedException e) {
+                } catch (GenericEntityException e) {
                     Debug.logError(e, "Error loading data file: " + dataUrl.toExternalForm(), module);
                 }
             }
-            pool.shutdownNow();
         } else {
             Debug.logImportant("=-=-=-=-=-=-= No data load files found.", module);
         }
@@ -483,14 +467,6 @@ public class EntityDataLoadContainer imp
         return true;
     }
 
-    private static Callable<Integer> createCallable(final URL dataUrl, final String helperBaseName, final Delegator delegator, final List<Object> errorMessages, final int txTimeout, final boolean useDummyFks, final boolean maintainTxs, final boolean tryInserts) {
-        return new Callable<Integer>() {
-            public Integer call() throws Exception {
-                return EntityDataLoader.loadData(dataUrl, helperBaseName, delegator, errorMessages, txTimeout, useDummyFks, maintainTxs, tryInserts);
-            }
-        };
-    }
-
     /**
      * @see org.ofbiz.base.container.Container#stop()
      */