Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 83551 invoked from network); 14 Oct 2010 06:44:14 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Oct 2010 06:44:14 -0000 Received: (qmail 15597 invoked by uid 500); 14 Oct 2010 06:44:13 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 15479 invoked by uid 500); 14 Oct 2010 06:44:12 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 15472 invoked by uid 99); 14 Oct 2010 06:44:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Oct 2010 06:44:11 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Oct 2010 06:44:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E3F2D23888EC; Thu, 14 Oct 2010 06:43:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1022386 - in /geronimo/devtools/eclipse-plugin/trunk/plugins: org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/ org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/ o... Date: Thu, 14 Oct 2010 06:43:12 -0000 To: scm@geronimo.apache.org From: delos@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101014064312.E3F2D23888EC@eris.apache.org> Author: delos Date: Thu Oct 14 06:43:12 2010 New Revision: 1022386 URL: http://svn.apache.org/viewvc?rev=1022386&view=rev Log: GERONIMODEVTOOLS-608 reduce time-consuming in DependencyHelper with cache. Thanks Boes and Chris for the patch Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/DependencyHelper.java geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v22.core/META-INF/MANIFEST.MF geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java?rev=1022386&r1=1022385&r2=1022386&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java (original) +++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/main/java/org/apache/geronimo/st/v11/core/internal/DependencyHelper.java Thu Oct 14 06:43:12 2010 @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import javax.xml.bind.JAXBElement; @@ -67,6 +68,8 @@ public class DependencyHelper { private List inputJAXBElements = new ArrayList(); private List reorderedJAXBElements = new ArrayList(); + //provide a cache + private ConcurrentHashMap environmentCache = new ConcurrentHashMap(); /** * Reorder the publish order of the modules based on any discovered dependencies @@ -78,6 +81,9 @@ public class DependencyHelper { */ public List reorderModules(IServer server, List modules, List deltaKind ) { Trace.tracePoint("Entry", "DependencyHelper.reorderModules", modules, deltaKind); + + //provide a cache + ConcurrentHashMap verifiedModules = new ConcurrentHashMap(); if (modules.size() == 0) { List reorderedLists = new ArrayList(2); @@ -125,8 +131,23 @@ public class DependencyHelper { if (dep.getType()!=null) configId.append(dep.getType()); - if (!DeploymentUtils.isInstalledModule(server,configId.toString())) - dm.addDependency( child, parent ); + //get install flag from the cache + Boolean isInstalledModule = verifiedModules + .get(configId.toString()); + if (isInstalledModule == null) { + // not in the cache, invoke + // isInstalledModule() method + isInstalledModule = DeploymentUtils + .isInstalledModule(server, + configId.toString()); + // put install flag into the cache for next + // retrieve + verifiedModules.put(configId.toString(), + isInstalledModule); + } + + if (!isInstalledModule) + dm.addDependency( child, parent ); } } } @@ -375,6 +396,12 @@ public class DependencyHelper { private EnvironmentType getEnvironment(IModule module) { Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", module); + // if module's environment is in the cache, get it from the cache + if(environmentCache.containsKey(module)) { + return environmentCache.get(module); + } + + EnvironmentType environment = null; if (GeronimoUtils.isWebModule(module)) { if (getWebDeploymentPlan(module) != null) { @@ -411,6 +438,9 @@ public class DependencyHelper { } } + //put module's environment into the cache for next retrieve + environmentCache.put(module, environment); + Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment); return environment; } Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/DependencyHelper.java URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/DependencyHelper.java?rev=1022386&r1=1022385&r2=1022386&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/DependencyHelper.java (original) +++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v21.core/src/main/java/org/apache/geronimo/st/v21/core/internal/DependencyHelper.java Thu Oct 14 06:43:12 2010 @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import javax.xml.bind.JAXBElement; @@ -67,6 +68,9 @@ public class DependencyHelper { private List inputJAXBElements = new ArrayList(); private List reorderedJAXBElements = new ArrayList(); + + //provide a cache + private ConcurrentHashMap environmentCache = new ConcurrentHashMap(); /** * Reorder the publish order of the modules based on any discovered dependencies @@ -78,6 +82,10 @@ public class DependencyHelper { */ public List reorderModules(IServer server, List modules, List deltaKind ) { Trace.tracePoint("Entry", "DependencyHelper.reorderModules", modules, deltaKind); + + //provide a cache + ConcurrentHashMap verifiedModules = new ConcurrentHashMap(); + if (modules.size() == 0) { List reorderedLists = new ArrayList(2); @@ -125,8 +133,23 @@ public class DependencyHelper { if (dep.getType()!=null) configId.append(dep.getType()); - if (!DeploymentUtils.isInstalledModule(server,configId.toString())) - dm.addDependency( child, parent ); + //get install flag from the cache + Boolean isInstalledModule = verifiedModules + .get(configId.toString()); + if (isInstalledModule == null) { + // not in the cache, invoke + // isInstalledModule() method + isInstalledModule = DeploymentUtils + .isInstalledModule(server, + configId.toString()); + // put install flag into the cache for next + // retrieve + verifiedModules.put(configId.toString(), + isInstalledModule); + } + + if (!isInstalledModule) + dm.addDependency( child, parent ); } } } @@ -374,6 +397,11 @@ public class DependencyHelper { */ private Environment getEnvironment(IModule module) { Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", module); + + // if module's environment is in the cache, get it from the cache + if(environmentCache.containsKey(module)) { + return environmentCache.get(module); + } Environment environment = null; if (GeronimoUtils.isWebModule(module)) { @@ -410,6 +438,9 @@ public class DependencyHelper { environment = plan.getServerEnvironment(); } } + + //put module's environment into the cache for next retrieve + environmentCache.put(module, environment); Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment); return environment; Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v22.core/META-INF/MANIFEST.MF URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v22.core/META-INF/MANIFEST.MF?rev=1022386&r1=1022385&r2=1022386&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v22.core/META-INF/MANIFEST.MF (original) +++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v22.core/META-INF/MANIFEST.MF Thu Oct 14 06:43:12 2010 @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.apache.geronimo.st.v22.core;singleton:=true Bundle-Version: 3.0.0 -Bundle-Activator: org.apache.geronimo.st.v21.core.Activator +Bundle-Activator: org.apache.geronimo.st.v22.core.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin Require-Bundle: org.apache.geronimo.runtime.v22, Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java?rev=1022386&r1=1022385&r2=1022386&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java (original) +++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v30.core/src/main/java/org/apache/geronimo/st/v30/core/internal/DependencyHelper.java Thu Oct 14 06:43:12 2010 @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import javax.xml.bind.JAXBElement; @@ -66,6 +67,9 @@ public class DependencyHelper { private List reorderedKinds = new ArrayList(); private List inputJAXBElements = new ArrayList(); private List reorderedJAXBElements = new ArrayList(); + + //provide a cache + private ConcurrentHashMap environmentCache = new ConcurrentHashMap(); /** @@ -78,6 +82,9 @@ public class DependencyHelper { */ public List reorderModules(IServer server, List modules, List deltaKind ) { Trace.tracePoint("Entry", "DependencyHelper.reorderModules", modules, deltaKind); + + //provide a cache + ConcurrentHashMap verifiedModules = new ConcurrentHashMap(); if (modules.size() == 0) { List reorderedLists = new ArrayList(2); @@ -125,7 +132,22 @@ public class DependencyHelper { if (dep.getType()!=null) configId.append(dep.getType()); - if (!DeploymentUtils.isInstalledModule(server,configId.toString())) + //get install flag from the cache + Boolean isInstalledModule = verifiedModules + .get(configId.toString()); + if (isInstalledModule == null) { + // not in the cache, invoke + // isInstalledModule() method + isInstalledModule = DeploymentUtils + .isInstalledModule(server, + configId.toString()); + // put install flag into the cache for next + // retrieve + verifiedModules.put(configId.toString(), + isInstalledModule); + } + + if (!isInstalledModule) dm.addDependency( child, parent ); } } @@ -374,6 +396,11 @@ public class DependencyHelper { */ private Environment getEnvironment(IModule module) { Trace.tracePoint("Enter", "DependencyHelper.getEnvironment", module); + + // if module's environment is in the cache, get it from the cache + if(environmentCache.containsKey(module)) { + return environmentCache.get(module); + } Environment environment = null; if (GeronimoUtils.isWebModule(module)) { @@ -411,6 +438,9 @@ public class DependencyHelper { } } + //put module's environment into the cache for next retrieve + environmentCache.put(module, environment); + Trace.tracePoint("Exit ", "DependencyHelper.getEnvironment", environment); return environment; }