org.apache.tomcat.util
Class ObjectSerializer

java.lang.Object
  |
  +--org.apache.tomcat.util.ObjectSerializer

public final class ObjectSerializer
extends java.lang.Object

Helper for object reloading. Will change the classloader of a serializable object. The object must be serializable - the caller should do special actions for all non-serializable objects ( like using their specific protocol ). Old comment: ( code works now for any object, not only HttpSession ) This class manages the serialization of HttpSession object across classloader reloads. It does this by first getting a copy of the HttpSessions hashtable from the SessionManager and then using a special internal class ObjectInputStream that uses the newly created classloader to de-serialize the sessions. This class is called from within the Handler.handleReload() method. Much of this code is essentially the same as what I put into the Apache JServ release so it is pretty well tested. It also depends on having HttpSession implement the read/writeObject methods properly to only accept objects that are serializable.

Author:
Jon S. Stevens, cmanolache@yahoo.com

Constructor Summary
ObjectSerializer()
           
 
Method Summary
static java.lang.Object doSerialization(java.lang.ClassLoader cl, java.lang.Object sessions)
          This is the method that does the serialization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectSerializer

public ObjectSerializer()
Method Detail

doSerialization

public static final java.lang.Object doSerialization(java.lang.ClassLoader cl,
                                                     java.lang.Object sessions)
This is the method that does the serialization.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.