Re: Stateful Web Services...

> Although there is one last thing that is confusing me. A Web Service
> life is controled by a Web Server like for example Tomcat. When a 
> request arrives, the class that implements the request is 
> dynamically loaded and the request is executed. When the request 
> ends the class is deallocated. This means this class cannot maintain
> its internal state. Any kind of data that was kept by it is garbage 
> collected. 
> 
> One of my questions is: 
> 
> Is it possible now to design a Web Service that is automatically 
> allocated when the user makes a request, and is only 
> deallocated/stops running when i want? This means that it will run 
> while the Web Server (Tomcat) is running.
> 

one way to deal with that is to store all session data in some life-cylce 
independent place, e.g. in
- a relational database,
- a naming/directory service (e.g. JNDI, Apache Commons Discovery, ...)
- static varibles fields of your class

hope this helps,
Joe

Received on Wednesday, 27 October 2004 13:39:32 UTC