oleg-vlsk commented on code in PR #12760:
URL: https://github.com/apache/ignite/pull/12760#discussion_r2836704073
##########
modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentLocalStore.java:
##########
@@ -296,23 +299,49 @@ private GridDeployment deploy(
try {
Deque<GridDeployment> cachedDeps = null;
- // Find existing class loader info.
- for (Deque<GridDeployment> deps : cache.values()) {
- for (GridDeployment d : deps) {
- if (d.classLoader() == ldr) {
- // Cache class and alias.
- fireEvt = d.addDeployedClass(cls, alias);
+ Deque<GridDeployment> depsByLdr = cacheByLdr.get(ldr);
Review Comment:
Not necessarily. In `GridDeploymentLocalStore#cache` we can have several
deployments with the same classloader associated with one alias/class name (see
attached screenshots). However, according to the current
`GridDeploymentLocalStore#deploy` code in master it looks like there is no
guarantee that all deployments in `cache` will have the same classloader (hence
the classloader `==` check in the lookup for-loop).
But I agree with you that for lookup purposes it's better to use the 1-to-1
relation between classloaders and deployments. That's why I additionally
introduced `Map<ClassLoader, GridDeployment> depsByLdr`.
But at the same time I kept the `Map<ClassLoader, Deque<GridDeployment>>
cacheByLdr` field in order to preserve the existing contract of `cache`, where
each alias/class is mapped to a colleciton of deployments associated with the
same classloader.
<img width="1203" height="852" alt="local deployments cache - 1"
src="https://github.com/user-attachments/assets/d9435325-bb3b-412e-be71-59ddf391cca1"
/>
<img width="1175" height="862" alt="local deployments cache - 2"
src="https://github.com/user-attachments/assets/0d7877ae-72cd-4540-ba02-e2705eb3d5c3"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]