You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adrian Crum <ad...@hlmksw.com> on 2010/06/02 00:58:59 UTC
Re: svn commit: r950278 - /ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
Bummer. I was looking forward to trying that out.
On 6/1/2010 3:00 PM, doogie@apache.org wrote:
> 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()
> */
>
>
>
Re: svn commit: r950278 - /ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Bummer. I was looking forward to trying that out.
There's a few issues with this. First, is that *all* tables get
created, in parallel, but they all have to be done before it creates
fk-index or declared-index. It's possible for the 2 latter items to
be done as soon as it's parent table is finished.
Second, is that no fk-index or declared-index is ever actually created.
You'll get it, I was working on it over the long weekend.