On Sun, 28 Nov 2004 15:36:27 -0800, Dakota Jack <[EMAIL PROTECTED]> wrote: [snip] > With hot deploy, instead of switching the implementation and the name > of the implementation class, e.g. ColonSeparatedMovieFinder for > DatabaseMovieFinder, you just have an implementation called > MovieFinderImplementation (or whatever you want, e.g. X) and a > MovieFinderImplementationHotFactory for getting object instance > implementations of the MovieFinder interfaces. Conceivably, in fact, > you can give people differing implementations with the same name by > simply putting them in different directories: no problem. This means > that the code can be dynamic and alterable at will and that there need > be no changes anywhere if you don't want there to be other than > dumping the new MovieFinderImplemenation.class in some directory > somewhere.
Within a single JVM (such as a servlet container), the only way to have different versions of the same fully qualified class name is to use different class loaders, which loads the different versions from lots of different places. That sounds like a pretty significant code management issue that any hot deploy strategy like what you describe would need to deal with. On the other hand, you're going to need individual class loaders to solve a different aspect of "hot deploy" as well ... recompiling an existing implementation class to modify its behavior (instead of trying to switch to a new one). There is no ClassLoader.unloadClass() method in Java, so the only way to "throw away" an old class is to throw away the class loader that contained it (and hope that the rest of the application doesn't have any pointers to the old class or any instances created by it, which would cause a big memory leak). That's what a servlet container does, for instance, when you reload an app -- it throws away the old context class loader and creates a new one. It's not a perfect solution, but it's not an easy problem, either. Craig Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]