Another question about codebases and jar versions

"Logan, Patrick" <[email protected]>
Newsgroups gmane.comp.java.sun.jini
Message-ID <[email protected]>
Something that is not clear to me about the java type system and jar
versions... please check my understanding...

The URI class loader will use the codebase URL to get the jar/class
associated with a marshalled object. OK.

If the URL is unchanged with the new jar version, and the class loader
has seen this URL already, then it (if it is the one out of the box)
will use the jar it already has and not repeat the download.

If the URL *is* changed, e.g. has a new digest if it is httpmd, or if
the URL per se or the jar file name has the version explicitly in it,
then the class loader *will* download the new jar.

However, this is where my understanding becomes hazy...

If the classes in the new jar have the same names as the classes in the
old jar, what will the out-of-the-box classloaders do?

A class is identified as a unique type by its class loader and the class
object. Will the class object from the new jar replace the old class,
and so possibly cause confusing with any lingering instances of the old
class?

Or will the new class be disregarded and the loader continues to use
just the old class?

Or...?

And so what should applications try to do when new class versions are
loaded?

(1) Developers make sure when this happens there are no instances
lingering for the old class?
(2) Developers make sure the JVM garbage collects the old classes --
this can get difficult?
(3) Or what? Is there a way to keep old instances with old class and new
instances with new classes?
(3a.) e.g. if the two sets of instances never interact? (e.g. through
preferred class lists)
(3b.) e.g. if the two sets of instances only interact through the well
known shared types of the local type system (loaders and classes on the
shared part of the class loader hierarchy.)

Thanks,
Patrick


Patrick Logan
Premium Innovation
Liberty Mutual - Agency Markets IT West
650 NE Holladay Street
PO Box 4555
Portland, OR   97208-4555

Office: 503.736.7537
Cell: 503.476.5387



--------------------------------------------------------------------------
Getting Started:     http://www.jini.org/wiki/Category:Getting_Started
Community Web Site:  http://jini.org
jini-users Archive:  http://archives.java.sun.com/archives/jini-users.html
Unsubscribing:       email "signoff JINI-USERS"  to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.