[MUD-Dev] Question about copyovers.

Adam ya_hoo_com at yahoo.com
Tue May 21 10:09:15 New Zealand Standard Time 2002


--- Kwon Ekstrom <justice at softhome.net> wrote:
> From: "Oliver Jowett" <oliver at randomly.org
 
> An interesting concept, I haven't played with Java classloading
> much, but it could be a solution.  The only objects directly
> referenced in my startup proceedure is the starting class and the
> networking code.  So it'd be quite possible to load those
> dynamically using a separate class-loader and then dereference the
> classloader.  It's something to look into when work slows down
> enough for me to work on my mud again.

Just be careful of the fact that some slightly painful gotchas exist
when making extensive use of classloaders.

E.g. if you load the same class from the same set of bytes on your
disk drive using two separate classloaders, then calling the Object
version of "instanceof" operator will always return false - since
this function makes use of the classloader to make the decision.

This may cause difficulties if combined with dynamic loading of your
own classes into a running system (e.g.if you want to do some quick
checks about the class file you're loading in good faith, like
ensuring it is actually of the correct type, before you start using
instances of it).

Although it'll still type-cast both classes to the same type,
IIRC. :). Personally, I found this rather confusing until I realised
what was going on (at the time, this was not mentioned at all in the
standard API docs).

Adam M
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the MUD-Dev mailing list