• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why are servlets serialized?

 
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are servlets serialized?
 
thomas davis
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nobody has answered for this question so far..
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by serialized?
 
Greenhorn
Posts: 11
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cant provide a solid answer on this, but I went to search google because I was curious about it to and on the 20th or so page of results, this link came back:
http://www.isse.gmu.edu/~lili/642/Servlets.pdf
IF you search that document for "serialized", it makes reference to if more service requests are recieved than the connection pool allows, then the requests are serialized (following this particular model). I dont know if this has any relevance to your question, but its an instance where servlet serialization is used..
 
Chad Patrick
Greenhorn
Posts: 11
Netbeans IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think i probably made that previous answer more complicated than it is...
I think servlets are serialized so you can save their state in the destoy() method when it unloads.. and reload it in the init().
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess thomas is talking about about single threaded access. If you do not want your servlet to be accessed by a single thread and multiple you use the SingleThreadModel.

The interface SingleThreadModel is an empty i/f and will be deprecated in servlet 2.4 spec.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
>>I think servlets are serialized so you can save their state in the destoy
>>() method when it unloads.. and reload it in the init().
I thought that serialization is required only we are sending data (or information) to another machine because the references in the source machine may not make sense in the destination machine.
But in the above case (unload and reload) the servlet exists on the same JVM.
Please let me know if I'm wrong.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The abstract class javax.servlet.GenericServlet implements Serializable - presumably to allow for saving the state of a servlet instance under some circumstances. Of course for serialization to succeed, all instance variables would have to be serializable too.
I have never heard of a circumstance in which this capability is actually used.
Bill
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

[ August 11, 2003: Message edited by: Syil Choi ]
reply
    Bookmark Topic Watch Topic
  • New Topic