IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Class loaders are an ugly kludge
And in my experience, I just make sure I load everything into one class loader (with a null parent). It seems to work pretty well.

It does sort of make sense that A is restricted for working with things in B but not the other way around. Because you have to remember that a class loader is a namespace or scope. Since A is B's parent, B has access to A but not vice versa.

By way of illustration they work (a little) like this
{ // A scope
int i = 5;
{ // B scope
int j = 6;
i = 7; // OK, B inherits A's scope
}
j = 8; // no good - j out of scope - not visible
}

What is also really strange is the following. Given the original scenario above, B calls A and passes A a parameter C. C's classloader (assuming C is some non-trivial object) will be B's classloader which is not visible to A, yet the parameter gets passed and A can see it and use it even though it is from a completely different and unaccessible classloader. How does that work?


I'm not sure I get it - but IIUC - when you pass C - what is the type of the reference that A sees and where is that type defined (not the concrete type of C - but its apparent type to A)? That is sort of the key. If the apparent type (Object for instance), is visible to A then it can use it (which is why you can do reflection tricks). Its kind of a hole in the system I think.




"Packed like lemmings into shiny metal boxes.
Contestants in a suicidal race."
    - Synchronicity II - The Police
Expand Edited by tuberculosis Aug. 21, 2007, 06:33:01 AM EDT
New Re: Class loaders are an ugly kludge
Unfortunately I cannot ensure that they will all be in one classloader as the code is running in an application server where ever application ahs it's own classloader.
New OK
But why do classes in the parent loader know about classes in the child loader?

Seems like a partitioning problem to me.



"Packed like lemmings into shiny metal boxes.
Contestants in a suicidal race."
    - Synchronicity II - The Police
Expand Edited by tuberculosis Aug. 21, 2007, 06:37:56 AM EDT
New It is a long story
Unfortunately it is not up to us to partition the system, the system is already partitioned this way and we need to work with it.
New And a sad one I'll bet
as long as you're screwed and needing to use lots of reflection - you might try using BeanShell and writing scripts in that where the reflection madness is required.




"Packed like lemmings into shiny metal boxes.
Contestants in a suicidal race."
    - Synchronicity II - The Police
Expand Edited by tuberculosis Aug. 21, 2007, 12:41:24 PM EDT
     Java ClassLoader question - (bluke) - (6)
         Re: Java ClassLoader question - (dshellman)
         Class loaders are an ugly kludge - (tuberculosis) - (4)
             Re: Class loaders are an ugly kludge - (bluke) - (3)
                 OK - (tuberculosis) - (2)
                     It is a long story - (bluke) - (1)
                         And a sad one I'll bet - (tuberculosis)

One shall be the number of Mojo Jojos in the world, and the number of Mojo Jojos in the world shall be one. Two Mojo Jojos is too many, and three is right out!
49 ms