Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why do genericServlet and HttpServlet implements serizable inferface

 
Brij Garg
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Can someone explain in details why do genericservlet and httpservlet implements serizable interface?

I just read that servlet engine can hibernate the servlet to store the state of the servlet or to duplicate the servlet instance for better load balancing.

Is there any pitfall of this?
How developer's work effected by this functionality of the servlet engine?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34179
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by bittoo garg:
Is there any pitfall of this?
How developer's work effected by this functionality of the servlet engine?

It's best not to be storing user specific state in a servlet in the first place as multiple users will access it. There could be state that applies to everyone - such as a data access object reference. In this case, you would want the data to be be serializable if your server implements hibernation.

I don't see the value of duplicating the servlet. The server could just create a new one.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic