Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can someone explain implements Serializable

 
Ray Smilgius
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a javabean that deals with connections to a backend server. On the web site, every jsp page hits the bean if i implement Serializable will this improve performance?
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No it won't improve performance. Why would you think it would? All that happens when you implement Serializable (which, remember is a "Tag" interface that does not define any methods) is that that object can now be Serialized to a Stream or File by the Java object Serialization framework. That is useful (for instance) if you are using Session clustering of any sort, since session clustering mechanisms either (a) Serialize things to a stream to send them from one machine to another or (b) Serialize them into a Binary Large Object column in a database so it can be shared among multiple application servers.
So, while making your objects stored in your sessions serializable won't improve performance, it *may* improve the scaleability of your app, which is a related matter. However, you must remember that things like back-end connections CANNOT be serialized at all. They must remain transient. So if you have a lot of set-up data, or some cached data from the back end, this may help, but if you don't then it won't even help scaleability.

Kyle
[ April 20, 2002: Message edited by: Kyle Brown ]
 
Greg Whelan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Out of curiousity, do you know if there is a predominant implementation approach? Sending by stream or BLOB?
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Neither is predominant. Just read your Application Server's documentation to see which one they use...
Kyle
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic