Alexey Petrenko wrote:
Guys,
I've reviewed the ClassLoaderLocal source and its usage in
PortableRemoteObjectExtImpl class (looks like it's the only place)...
It is not fully clear for me what ClassLocalMap is used for... But as
far as I understood it is used for RMIState objects storage connected
to the current thread.
Is that correct?
I don't fully understand the code either, but I came to the same
conclusions as you did.
The only actual *use* of the classes Vector seems to be in
ClassLoaderLocal.getLoaderLocalMap():
Vector v = getClassesVector(cl);
Object o = v.get(0);
if (!(o instanceof ClassLocalMap)) {
map = new ClassLocalMap();
v.add(o);
v.set(0, map);
} else {
map = (ClassLocalMap) o;
}
In other words, this code implements a mapping from the current thread's
context classloader to some ClassLocalMap object. It is not clear to me
why that mapping has to be stored in the ClassLoader's classes vector.
Shouldn't it be stored somewhere in the ClassLoaderLocal class?
/Lars