As the (Sun) Java Preferences implementation only creates a PreferencesFactory instance *once* per JVM (as static final), reloading the Jetspeed Portal (using a new classloader) requires a wrapper solution to prevent ClassCastExceptions and/or out-of-sync kept proxies and caches.
As a newly created Jetspeed Portal classloader can no longer cast a previous Preferences root to its own PreferencesImpl, a "trick" is used by also implementing the Observer interface (which is provided by the Java system classloader). The Observer interface is used because it is very lightweight and allows passing an Object instance through its update method. That update method is used to "inject" the newly created Preferences root instance.
@author Ate Douma @version $Id: PreferencesRootWrapper.java 740489 2009-02-03 22:25:06Z taylor $
|
|