-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stanimir,

On 2/10/2009 11:25 AM, Stanimir Komitov wrote:
> How to exclude some classes to being serialized in sharing session with
> clustered tomcats?

Do you mean avoiding serializing some /objects/ in shared sessions?

I can see your problem. You want:

1.  An object in the session
2a. The object's class is not serializable
or
2b. The object is very large
3.  The session should properly migrate between cluster nodes

The only way I can think of doing this is writing an object wrapper.
Something like this:

public class TransientObjectWrapper
  implements Serializable
{
  private static final Object UNINITIALIZED = new Object();
  private transient final Object _wrapped;

  public TransientObjectWrapper(Object wrapped)
  {
    _wrapped = wrapped;
  }

  public Object get()
  {
    return initialized() ? _wrapped : null;
  }

  public boolean initialized()
  {
    return _wrapped != UNINITIALIZED;
  }

  // Capture de-serialization events and mark the wrapped
  // object as uninitialized
  private void readObject(ObjectInputStream in)
  {
    in.defaultReadObject();

    _wrapped = UNINITIALIZED;
  }
}

> And why the application scope beans are serialized too?

Objects placed in the application scope do not need to be serializable.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmR4fAACgkQ9CaO5/Lv0PBJJQCfZPhLXNWLOEzP6V8GsJWfiCxQ
fIcAnjISVtRwyOAl87xKZECvkXLZsWEA
=ZN8E
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to