1. JServ does not AFAIK support session migration. For a servlet engine that does, yes your data would have to be serializable in order for it to migrate it. We support failover (not migration) in our multi-server JServ setup by having all pertinent session data stored in a database, of which the data in HttpSession is a write-through cache. If a new session is needed, we just recreate the cache by reading it from the DB.

2. A session doesn't belong to one servlet, it belongs to the container. Thus, the servlet doesn't have any sessions active, but it can have request threads active. There are two ways to use servlets - in the multi-threaded model, each servlet is a singleton, and there can be many threads active in a single object instance of the servlet class. In the single-threaded model, JServ will create a pool of servlet object instances, and each one will only have one thread at a time.

The safe and easy way to manage this is to have the servlet be pure code, with only static methods, using the multi-threaded model (effectively, at the application level, it's a zero-instance class). You can then use other objects of different types to store data on HttpSession, using the put and get calls. Data shared across sessions can be accessed using non-servlet singleton classes.

The JVM's base classloader is free to garbage collect unused classes (those which have no object instances in existence) unless you specify "-noclassgc" on the command line.

Similarly, JServ's zone classloader which is used to load the repository classes, including the servlets, automatically unloads and reloads servlet classes dyanmically. If you want to suppress this behaviour you can turn off autoreload in jserv.properties.
 
 

Richard Ou wrote:

----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Hi,

I'm running on Apache 1.3.9 and Jserv 1.1 on solaris, and had a couple
of questions I was hoping someone could help me with:

 - I'm using cookies to establish a session with my servlet, and storing
   data with the session using the HttpSession.putValue() call.  Is it
   true that this data needs to be Serializable so the servlet engine
   has the option of migrating it between different Jserv instances?
   Does apache Jserv actually ever do this currently, and if so is there
   a configuration option to turn this off?

 - The servlet doc I've looked at says a servlet container can unload a
   servlet at any time - but will this ever happen while a servlet still
   has a session active?  I understand the servlets will get reloaded if
   the class files themselves change, and that the session may also
   timeout.  But are there any other reasons the servlet engine might
   unload a servlet such that a returning client would not be able to
   access data from its session (using the HttpSession.getValue() call)?

Thanks in advance for any advice you can give!

-Rich

--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives:
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]


--
David Crooke, Austin TX, USA.
Bibo ergo sum.
Open Standards. Open Source. Open Minds.
 

Reply via email to