• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session Objects and subclasses

 
Roger Irvin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a web based application and using the servlet session API to manage a class that represents an order. The order class contains several instance variables (beans, string[], and vectors of beans) that are private to the class represent order components. There are also public methods within the class that modify the instance variables. Since I am associating the user to a specific order class via session calls I am concerned about resource usage since the class has become sizeable. I was thinking about moving the public methods to another class that extends the order class, but I'm not sure how this will effect session management. If I simply use the session get and set attribute methods for the subclass as I do for the order class this will not reduce resource usage. I could build a separate class (not a subclass) and pass the instance variables of the order class to the new class for manipulation, but don't see how this will reduce resources either.
Any other ideas?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi roger
i dont think that subclassing would help here. besides just moving methods out side the class doesnt make it a lot smaller because methods are anyways store din method aread and objects are stored in heaps. so the data members really would matter in the size of the object more than the methods in the object.
i'm not sure what other ways we can employ to reduce the size of the object..
may be, u can implement Externalizable, if u r not doing it already, instead of the Serializable and make ur code little better as u have more control over what gets written in serializing and what not..
also, look at all the fields in the class and see which fields really need to get serialized. the ones that are not required to be serialize , make them transient..
well all of this was general tip one would say but i am not able to think anything else as of now..
any other input?
regards
maulin
 
Dana Hanna
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps your customers are just buying too much.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!