From 56e658cbb78ca88bff59e3fa88364e95b57fd670 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Tue, 13 Aug 2024 08:37:36 -0500 Subject: [PATCH] TEMP - Reuse computed ModuleClassesContainerInfo --- .../internal/WebModuleClassesInfoAdapter.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/internal/WebModuleClassesInfoAdapter.java b/dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/internal/WebModuleClassesInfoAdapter.java index 5e7bdc4c9967..0c0899590227 100644 --- a/dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/internal/WebModuleClassesInfoAdapter.java +++ b/dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/internal/WebModuleClassesInfoAdapter.java @@ -18,10 +18,12 @@ import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent; import com.ibm.ws.container.service.app.deploy.ContainerInfo; +import com.ibm.ws.container.service.app.deploy.ModuleClassesContainerInfo; import com.ibm.ws.container.service.app.deploy.WebModuleClassesInfo; import com.ibm.ws.container.service.app.deploy.extended.ManifestClassPathHelper; import com.ibm.wsspi.adaptable.module.Container; import com.ibm.wsspi.adaptable.module.Entry; +import com.ibm.wsspi.adaptable.module.NonPersistentCache; import com.ibm.wsspi.adaptable.module.UnableToAdaptException; import com.ibm.wsspi.adaptable.module.adapters.ContainerAdapter; import com.ibm.wsspi.artifact.ArtifactContainer; @@ -48,7 +50,24 @@ public WebModuleClassesInfo adapt(Container root, OverlayContainer rootOverlay, //either we created this already, or OSGi prepopulated it. return classesInfo; } + NonPersistentCache cache = containerToAdapt.adapt(NonPersistentCache.class); + final ModuleClassesContainerInfo classesContainerInfo = (ModuleClassesContainerInfo) cache.getFromCache(ModuleClassesContainerInfo.class); + if (classesContainerInfo != null) { + classesInfo = new WebModuleClassesInfo() { + @Override + public List getClassesContainers() { + return classesContainerInfo.getClassesContainerInfo(); + } + }; + } else { + throw new IllegalStateException("TJW ... just a test"); + //classesInfo = computeWebModuleClassesInfo(containerToAdapt); + } + rootOverlay.addToNonPersistentCache(artifactContainer.getPath(), WebModuleClassesInfo.class, classesInfo); + return classesInfo; + } + private WebModuleClassesInfo computeWebModuleClassesInfo(Container containerToAdapt) throws UnableToAdaptException { ArrayList resolved = new ArrayList(); final List containerInfos = new ArrayList(); @@ -120,15 +139,12 @@ public Container getContainer() { } } - classesInfo = new WebModuleClassesInfo() { + return new WebModuleClassesInfo() { @Override public List getClassesContainers() { return containerInfos; } }; - - rootOverlay.addToNonPersistentCache(artifactContainer.getPath(), WebModuleClassesInfo.class, classesInfo); - return classesInfo; } }