Skip to content

Commit

Permalink
TEMP - Reuse computed ModuleClassesContainerInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
tjwatson committed Aug 13, 2024
1 parent aa6137c commit 56e658c
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<ContainerInfo> 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<String> resolved = new ArrayList<String>();
final List<ContainerInfo> containerInfos = new ArrayList<ContainerInfo>();

Expand Down Expand Up @@ -120,15 +139,12 @@ public Container getContainer() {
}
}

classesInfo = new WebModuleClassesInfo() {
return new WebModuleClassesInfo() {
@Override
public List<ContainerInfo> getClassesContainers() {
return containerInfos;
}
};

rootOverlay.addToNonPersistentCache(artifactContainer.getPath(), WebModuleClassesInfo.class, classesInfo);
return classesInfo;
}

}

0 comments on commit 56e658c

Please sign in to comment.