Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/HttpClient.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/HttpClient.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/HttpClient.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/src/org/ofbiz/base/util/HttpClient.java Mon Sep 29 07:08:04 2014 @@ -373,7 +373,7 @@ public class HttpClient { charset = contentType.substring(charsetEqualsLoc + 1); } - if (charset != null) charset = charset.trim(); + if (charset != null) charset = charset.trim().replaceAll("\"", ""); if (Debug.verboseOn() || debug) Debug.logVerbose("Getting text from HttpClient with charset: " + charset, module); }
Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/base/testdef/basetests.xml Mon Sep 29 07:08:04 2014 @@ -32,7 +32,6 @@ <junit-test-suite class-name="org.ofbiz.base.util.cache.test.UtilCacheTests"/> <junit-test-suite class-name="org.ofbiz.base.conversion.test.DateTimeTests"/> <junit-test-suite class-name="org.ofbiz.base.conversion.test.MiscTests"/> - <junit-test-suite class-name="org.ofbiz.base.concurrent.test.DependencyPoolTests"/> <junit-test-suite class-name="org.ofbiz.base.json.test.JSONTests"/> <!--junit-test-suite class-name="org.ofbiz.base.util.test.UtilIOTests"/--> <junit-test-suite class-name="org.ofbiz.base.test.BaseUnitTests"/> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/ofbiz-component.xml Mon Sep 29 07:08:04 2014 @@ -74,11 +74,11 @@ under the License. <property name="secure" value="false"/> <property name="URIEncoding" value="UTF-8"/> <property name="xpoweredBy" value="true"/> - <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) --> <!-- AJP/13 connector attributes --> <!-- commented out because the values match the Tomcat defaults: <property name="tomcatAuthentication" value="true"/> <property name="allowTrace" value="false"/> + <property name="enableLookups" value="false"/> <property name="maxPostSize" value="2097152"/> <property name="noCompressionUserAgents" value=""/> <property name="connectionLinger" value="-1"/> @@ -102,11 +102,11 @@ under the License. <property name="secure" value="false"/> <property name="URIEncoding" value="UTF-8"/> <property name="xpoweredBy" value="true"/> - <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) --> <property name="compression" value="on"/> <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/> <!-- commented out because the values match the Tomcat defaults: <property name="allowTrace" value="false"/> + <property name="enableLookups" value="false"/> <property name="maxPostSize" value="2097152"/> <property name="noCompressionUserAgents" value=""/> <property name="connectionLinger" value="-1"/> @@ -131,7 +131,6 @@ under the License. <property name="SSLEnabled" value="true"/> <property name="URIEncoding" value="UTF-8"/> <property name="xpoweredBy" value="true"/> - <property name="enableLookups" value="true"/> <!-- set to false to improve performance (false is the default value in Tomcat) --> <property name="compression" value="on"/> <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/> <!-- SSL connector attributes --> @@ -178,7 +177,6 @@ under the License. <property name="secure" value="false"/> <property name="URIEncoding" value="UTF-8"/> <property name="xpoweredBy" value="true"/> - <property name="enableLookups" value="true"/> </property> <property name="http-connector" value="connector"> <property name="port" value="8080"/> @@ -187,7 +185,6 @@ under the License. <property name="secure" value="false"/> <property name="URIEncoding" value="UTF-8"/> <property name="xpoweredBy" value="true"/> - <property name="enableLookups" value="true"/> <property name="compression" value="on"/> <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/> </property> @@ -199,7 +196,6 @@ under the License. <property name="SSLEnabled" value="true"/> <property name="URIEncoding" value="UTF-8"/> <property name="xpoweredBy" value="true"/> - <property name="enableLookups" value="true"/> <property name="compression" value="on"/> <property name="compressableMimeType" value="text/html,text/xml,text/plain,text/javascript,text/css"/> <property name="sslImplementationName" value="org.ofbiz.catalina.container.SSLImpl"/> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Mon Sep 29 07:08:04 2014 @@ -41,7 +41,6 @@ import org.apache.catalina.Host; import org.apache.catalina.LifecycleException; import org.apache.catalina.Manager; import org.apache.catalina.connector.Connector; -import org.apache.catalina.core.JreMemoryLeakPreventionListener; import org.apache.catalina.core.StandardContext; import org.apache.catalina.core.StandardEngine; import org.apache.catalina.core.StandardHost; @@ -140,7 +139,7 @@ public class CatalinaContainer implement public static final String module = CatalinaContainer.class.getName(); private static final ThreadGroup CATALINA_THREAD_GROUP = new ThreadGroup("CatalinaContainer"); - // load the JSSE propertes (set the trust store) + // load the JSSE properties (set the trust store) static { SSLUtil.loadJsseProperties(); } @@ -185,17 +184,6 @@ public class CatalinaContainer implement tomcat = new Tomcat(); tomcat.setBaseDir(System.getProperty("ofbiz.home")); - // https://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JRE_Memory_Leak_Prevention_Listener_-_org.apache.catalina.core.JreMemoryLeakPreventionListener - // <<The JRE Memory Leak Prevention Listener provides work-arounds for known places where the Java Runtime environment uses - // the context class loader to load a singleton as this will cause a memory leak if a web application class loader happens - // to be the context class loader at the time.>> - // http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?view=annotate - JreMemoryLeakPreventionListener jreMemoryLeakPreventionListener = new JreMemoryLeakPreventionListener(); - // Mostly use default config, but some specific cases here - jreMemoryLeakPreventionListener.setAppContextProtection(true); // True is the default for Java 1.6, use false for Java from 1.7.0_02 onwards (see sources above) - jreMemoryLeakPreventionListener.setGcDaemonProtection(false); // False because of https://mail-archives.apache.org/mod_mbox/tomcat-users/201008.mbox/%3CAANLkTino=bjp5lsbcwncb2hvndzyklr5y-8ywdt15...@mail.gmail.com%3E - jreMemoryLeakPreventionListener.setUrlCacheProtection(false); // False to keep the URLConnection cache, moot point - // configure JNDI in the StandardServer StandardServer server = (StandardServer) tomcat.getServer(); if (useNaming) { @@ -628,7 +616,7 @@ public class CatalinaContainer implement return; } - ScheduledExecutorService executor = ExecutionPool.getScheduledExecutor(CATALINA_THREAD_GROUP, "catalina-startup", -1, true); + ScheduledExecutorService executor = ExecutionPool.getScheduledExecutor(CATALINA_THREAD_GROUP, "catalina-startup", Runtime.getRuntime().availableProcessors(), 0, true); try { List<Future<Context>> futures = new ArrayList<Future<Context>>(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/build.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/build.xml?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/build.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/build.xml Mon Sep 29 07:08:04 2014 @@ -47,8 +47,8 @@ under the License. <main-jar/> <test-jar> <test-selector> - <filename name="META-INF/services" negate="true"/> - <filename name="META-INF/services/*" negate="true"/> + <filename name="META-INF/services"/> + <filename name="META-INF/services/*"/> </test-selector> </test-jar> </target> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/dtd/entity-config.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/dtd/entity-config.xsd?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/dtd/entity-config.xsd (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/dtd/entity-config.xsd Mon Sep 29 07:08:04 2014 @@ -411,7 +411,7 @@ under the License. <xs:attribute type="xs:string" name="table-type"/> <xs:attribute type="xs:string" name="character-set"/> <xs:attribute type="xs:string" name="collate"/> - <xs:attribute type="xs:integer" name="max-worker-pool-size" default="0"/> + <xs:attribute type="xs:integer" name="max-worker-pool-size" default="1"/> </xs:attributeGroup> <xs:element name="sql-load-path"> <xs:complexType> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java Mon Sep 29 07:08:04 2014 @@ -36,7 +36,7 @@ public abstract class DelegatorFactory i public static final String module = DelegatorFactoryImpl.class.getName(); private static final ConcurrentHashMap<String, Future<Delegator>> delegators = new ConcurrentHashMap<String, Future<Delegator>>(); private static final ThreadGroup DELEGATOR_THREAD_GROUP = new ThreadGroup("DelegatorFactory"); - private static final ScheduledExecutorService executor = ExecutionPool.getScheduledExecutor(DELEGATOR_THREAD_GROUP, "delegator-startup", -1, true); + private static final ScheduledExecutorService executor = ExecutionPool.getScheduledExecutor(DELEGATOR_THREAD_GROUP, "delegator-startup", Runtime.getRuntime().availableProcessors(), 10, true); public static Delegator getDelegator(String delegatorName) { Future<Delegator> future = getDelegatorFuture(delegatorName); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/config/model/Datasource.java Mon Sep 29 07:08:04 2014 @@ -169,8 +169,8 @@ public final class Datasource { int maxWorkerPoolSizeInt = Integer.parseInt(maxWorkerPoolSize); if (maxWorkerPoolSizeInt == 0) { maxWorkerPoolSizeInt = 1; - } else if (maxWorkerPoolSizeInt < -2) { - maxWorkerPoolSizeInt = -2; + } else if (maxWorkerPoolSizeInt < 0) { + maxWorkerPoolSizeInt = Math.abs(maxWorkerPoolSizeInt) * Runtime.getRuntime().availableProcessors(); } this.maxWorkerPoolSize = maxWorkerPoolSizeInt; } catch (Exception e) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Mon Sep 29 07:08:04 2014 @@ -31,12 +31,8 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeSet; -import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Future; -import org.ofbiz.base.concurrent.ExecutionPool; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; @@ -78,7 +74,6 @@ public class GenericDAO { private final GenericHelperInfo helperInfo; private final ModelFieldTypeReader modelFieldTypeReader; private final Datasource datasource; - private final ExecutorService executor; public static GenericDAO getGenericDAO(GenericHelperInfo helperInfo) { String cacheKey = helperInfo.getHelperFullName(); @@ -94,11 +89,6 @@ public class GenericDAO { this.helperInfo = helperInfo; this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperInfo.getHelperBaseName()); this.datasource = EntityConfig.getDatasource(helperInfo.getHelperBaseName()); - this.executor = ExecutionPool.getScheduledExecutor(GENERIC_DAO_THREAD_GROUP, "OFBiz-entity-datasource(" + helperInfo.getHelperFullName() + ")", datasource.getMaxWorkerPoolSize(), false); - } - - public <T> Future<T> submitWork(Callable<T> callable) throws GenericEntityException { - return this.executor.submit(callable); } private void addFieldIfMissing(List<ModelField> fieldsToSave, String fieldName, ModelEntity modelEntity) { @@ -1228,13 +1218,13 @@ public class GenericDAO { /* ====================================================================== */ public void checkDb(Map<String, ModelEntity> modelEntities, List<String> messages, boolean addMissing) { - DatabaseUtil dbUtil = new DatabaseUtil(this.helperInfo, this.executor); + DatabaseUtil dbUtil = new DatabaseUtil(this.helperInfo); dbUtil.checkDb(modelEntities, messages, addMissing); } /** Creates a list of ModelEntity objects based on meta data from the database */ public List<ModelEntity> induceModelFromDb(Collection<String> messages) { - DatabaseUtil dbUtil = new DatabaseUtil(this.helperInfo, this.executor); + DatabaseUtil dbUtil = new DatabaseUtil(this.helperInfo); return dbUtil.induceModelFromDb(messages); } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelper.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelper.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelper.java Mon Sep 29 07:08:04 2014 @@ -49,8 +49,6 @@ public interface GenericHelper { */ public String getHelperName(); - public <T> Future<T> submitWork(Callable<T> callable) throws GenericEntityException; - /** Creates a Entity in the form of a GenericValue and write it to the database *@return GenericValue instance containing the new instance */ Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperDAO.java Mon Sep 29 07:08:04 2014 @@ -57,10 +57,6 @@ public class GenericHelperDAO implements return this.helperInfo.getHelperFullName(); } - public <T> Future<T> submitWork(Callable<T> callable) throws GenericEntityException { - return genericDAO.submitWork(callable); - } - /** Creates a Entity in the form of a GenericValue and write it to the database *@return GenericValue instance containing the new instance */ Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Mon Sep 29 07:08:04 2014 @@ -40,6 +40,7 @@ import java.util.Set; import java.util.TreeSet; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; @@ -47,7 +48,6 @@ import org.ofbiz.base.concurrent.Executi import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilTimer; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.base.util.UtilXml; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.config.model.Datasource; import org.ofbiz.entity.config.model.EntityConfig; @@ -62,8 +62,6 @@ import org.ofbiz.entity.model.ModelRelat import org.ofbiz.entity.model.ModelViewEntity; import org.ofbiz.entity.transaction.TransactionFactoryLoader; import org.ofbiz.entity.transaction.TransactionUtil; -import org.w3c.dom.Document; -import org.w3c.dom.Element; /** * Utilities for Entity Database Maintenance @@ -85,52 +83,12 @@ public class DatabaseUtil { protected String password = null; boolean isLegacy = false; - protected ExecutorService executor; // OFBiz DatabaseUtil public DatabaseUtil(GenericHelperInfo helperInfo) { - this(helperInfo, null); - } - - public DatabaseUtil(GenericHelperInfo helperInfo, ExecutorService executor) { this.helperInfo = helperInfo; this.modelFieldTypeReader = ModelFieldTypeReader.getModelFieldTypeReader(helperInfo.getHelperBaseName()); this.datasourceInfo = EntityConfig.getDatasource(helperInfo.getHelperBaseName()); - this.executor = executor; - } - - // Legacy DatabaseUtil - public DatabaseUtil(String driverName, String connectionUrl, String userName, String password) { - this.driverName = driverName; - this.connectionUrl = connectionUrl; - this.userName = userName; - this.password = password; - this.isLegacy = true; - } - - protected <T> Future<T> submitWork(Callable<T> callable) { - if (this.executor == null) { - FutureTask<T> task = new FutureTask<T>(callable); - task.run(); - return task; - } - return this.executor.submit(callable); - } - - protected <T> List<Future<T>> submitAll(Collection<? extends Callable<T>> tasks) { - List<Future<T>> futures = new ArrayList<Future<T>>(tasks.size()); - if (this.executor == null) { - for (Callable<T> callable: tasks) { - FutureTask<T> task = new FutureTask<T>(callable); - task.run(); - futures.add(task); - } - return futures; - } - for (Callable<T> callable: tasks) { - futures.add(this.executor.submit(callable)); - } - return futures; } protected Connection getConnection() throws SQLException, GenericEntityException { @@ -216,6 +174,9 @@ public class DatabaseUtil { if (isLegacy) { throw new RuntimeException("Cannot run checkDb on a legacy database connection; configure a database helper (entityengine.xml)"); } + + ExecutorService executor = Executors.newFixedThreadPool(datasourceInfo.getMaxWorkerPoolSize()); + UtilTimer timer = new UtilTimer(); timer.timerString("Start - Before Get Database Meta Data"); @@ -233,7 +194,7 @@ public class DatabaseUtil { timer.timerString("After Get All Table Names"); // get ALL column info, put into hashmap by table name - Map<String, Map<String, ColumnCheckInfo>> colInfo = this.getColumnInfo(tableNames, checkPks, messages); + Map<String, Map<String, ColumnCheckInfo>> colInfo = getColumnInfo(tableNames, checkPks, messages, executor); if (colInfo == null) { String message = "Could not get column information from the database, aborting."; if (messages != null) messages.add(message); @@ -455,7 +416,7 @@ public class DatabaseUtil { if (addMissing) { // create the table - tableFutures.add(submitWork(new CreateTableCallable(entity, modelEntities, tableName))); + tableFutures.add(executor.submit(new CreateTableCallable(entity, modelEntities, tableName))); } } } @@ -478,7 +439,7 @@ public class DatabaseUtil { List<Future<AbstractCountingCallable>> fkIndicesFutures = new LinkedList<Future<AbstractCountingCallable>>(); for (ModelEntity curEntity: entitiesAdded) { if (curEntity.getRelationsOneSize() > 0) { - fkIndicesFutures.add(submitWork(new AbstractCountingCallable(curEntity, modelEntities) { + fkIndicesFutures.add(executor.submit(new AbstractCountingCallable(curEntity, modelEntities) { public AbstractCountingCallable call() throws Exception { count = createForeignKeyIndices(entity, datasourceInfo.getConstraintNameClipLength(), messages); return this; @@ -507,7 +468,7 @@ public class DatabaseUtil { List<Future<AbstractCountingCallable>> disFutures = new LinkedList<Future<AbstractCountingCallable>>(); for (ModelEntity curEntity: entitiesAdded) { if (curEntity.getIndexesSize() > 0) { - disFutures.add(submitWork(new AbstractCountingCallable(curEntity, modelEntities) { + disFutures.add(executor.submit(new AbstractCountingCallable(curEntity, modelEntities) { public AbstractCountingCallable call() throws Exception { count = createDeclaredIndices(entity, messages); return this; @@ -755,17 +716,19 @@ public class DatabaseUtil { } - + executor.shutdown(); timer.timerString("Finished Checking Entity Database"); } /** Creates a list of ModelEntity objects based on meta data from the database */ public List<ModelEntity> induceModelFromDb(Collection<String> messages) { + ExecutorService executor = Executors.newFixedThreadPool(datasourceInfo.getMaxWorkerPoolSize()); + // get ALL tables from this database TreeSet<String> tableNames = this.getTableNames(messages); // get ALL column info, put into hashmap by table name - Map<String, Map<String, ColumnCheckInfo>> colInfo = this.getColumnInfo(tableNames, true, messages); + Map<String, Map<String, ColumnCheckInfo>> colInfo = getColumnInfo(tableNames, true, messages, executor); // go through each table and make a ModelEntity object, add to list // for each entity make corresponding ModelField objects @@ -789,66 +752,10 @@ public class DatabaseUtil { newEntList.add(newEntity); } + executor.shutdown(); return newEntList; } - public Document induceModelFromDb(String packageName) { - Document document = UtilXml.makeEmptyXmlDocument("entitymodel"); - Element root = document.getDocumentElement(); - root.appendChild(document.createElement("title")); - root.appendChild(document.createElement("description")); - root.appendChild(document.createElement("copyright")); - root.appendChild(document.createElement("author")); - root.appendChild(document.createElement("version")); - - // messages list - List<String> messages = new ArrayList<String>(); - - // get ALL tables from this database - TreeSet<String> tableNames = this.getTableNames(messages); - - // get ALL column info, put into hashmap by table name - Map<String, Map<String, ColumnCheckInfo>> colInfo = this.getColumnInfo(tableNames, true, messages); - - boolean isCaseSensitive = false; - DatabaseMetaData dbData = this.getDatabaseMetaData(null, messages); - if (dbData != null) { - try { - isCaseSensitive = dbData.supportsMixedCaseIdentifiers(); - } catch (SQLException e) { - Debug.logError(e, "Error getting db meta data about case sensitive", module); - } - } - - if (UtilValidate.isNotEmpty(packageName)) { - String catalogName = null; - try { - catalogName = this.getConnection().getCatalog(); - } catch (Exception e) { - // ignore - } - packageName = "org.ofbiz.ext." + (catalogName != null ? catalogName : "unknown"); - } - - - // iterate over the table names is alphabetical order - for (String tableName: new TreeSet<String>(colInfo.keySet())) { - Map<String, ColumnCheckInfo> colMap = colInfo.get(tableName); - ModelEntity newEntity = new ModelEntity(tableName, colMap, modelFieldTypeReader, isCaseSensitive); - root.appendChild(newEntity.toXmlElement(document, "org.ofbiz.ext." + packageName)); - } - - // print the messages to the console - for (String message: messages) { - Debug.logInfo(message, module); - } - return document; - } - - public Document induceModelFromDb() { - return this.induceModelFromDb(""); - } - public DatabaseMetaData getDatabaseMetaData(Connection connection, Collection<String> messages) { if (connection == null) { connection = getConnectionLogged(messages); @@ -1129,7 +1036,7 @@ public class DatabaseUtil { }; } - public Map<String, Map<String, ColumnCheckInfo>> getColumnInfo(Set<String> tableNames, boolean getPks, Collection<String> messages) { + private Map<String, Map<String, ColumnCheckInfo>> getColumnInfo(Set<String> tableNames, boolean getPks, Collection<String> messages, ExecutorService executor) { // if there are no tableNames, don't even try to get the columns if (tableNames.size() == 0) { return new HashMap<String, Map<String, ColumnCheckInfo>>(); @@ -1261,7 +1168,7 @@ public class DatabaseUtil { List<Future<AbstractCountingCallable>> pkFetcherFutures = new LinkedList<Future<AbstractCountingCallable>>(); for (String curTable: tableNames) { curTable = curTable.substring(curTable.indexOf('.') + 1); //cut off schema name - pkFetcherFutures.add(submitWork(createPrimaryKeyFetcher(dbData, lookupSchemaName, needsUpperCase, colInfo, messages, curTable))); + pkFetcherFutures.add(executor.submit(createPrimaryKeyFetcher(dbData, lookupSchemaName, needsUpperCase, colInfo, messages, curTable))); } for (AbstractCountingCallable pkFetcherCallable: ExecutionPool.getAllFutures(pkFetcherFutures)) { pkCount += pkFetcherCallable.updateData(messages); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/framework/minilang/src/org/ofbiz/minilang/test/MiniLangTests.java Mon Sep 29 07:08:04 2014 @@ -91,4 +91,18 @@ public class MiniLangTests extends OFBiz assertTrue("<assert> error message text", errorMessage.startsWith("Assertion failed:")); } + public void testFieldToResultOperation() throws Exception { + String simpleMethodXml = "<simple-method name=\"testFieldToResult\">" + + " <set field=\"resultValue\" value=\"someResultValue\"/>" + + " <set field=\"result1\" value=\"dynamicResultName\"/>" + + " <field-to-result field=\"resultValue\" result-name=\"constantResultName\"/>" + + " <field-to-result field=\"resultValue\" result-name=\"${result1}\"/>" + + "</simple-method>"; + SimpleMethod methodToTest = createSimpleMethod(simpleMethodXml); + MethodContext context = createServiceMethodContext(); + String result = methodToTest.exec(context); + assertEquals("testFieldToResult success result", methodToTest.getDefaultSuccessCode(), result); + assertEquals("Constant result name set", "someResultValue", context.getResult("constantResultName")); + //assertEquals("Dynamic result name set", "someResultValue", context.getResult("dynamicResultName")); This one fails! + } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/template/cms/HtmlHead.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/template/cms/HtmlHead.ftl?rev=1628129&r1=1628128&r2=1628129&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/template/cms/HtmlHead.ftl (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/specialpurpose/cmssite/template/cms/HtmlHead.ftl Mon Sep 29 07:08:04 2014 @@ -16,6 +16,7 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <#if locale??>