Re: Stateful Web Services...
| Newsgroups | gmane.comp.web.services.general |
|---|---|
| Message-ID | <OF6771FA04.B7121B50-ONC1256F3A.004AB001-C1256F3A.004B0386@unisg.ch> |
> 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