I am trying to determine what I have in session at any given time. To that effect I am trying to write a jsp that will get the objects in session and then list them. This Jsp is independant and would read the current browser session. Also I would like to know the size of these objects. Is this possible Please Help
session means period like in class u have period and at parrticular period u study.That material u get from that period. In real world like shopping card application u put information like what the current user have buied the things. U can put id of user. U can also put session bean object reference. its all depends upon your design and what u think. Jawwad Ahmed SCJP SCWCD firstname.lastname@example.org
Joined: May 29, 2002
Ok, I have got my list of attributes from the session. How can I determine the size of the session object? Can I also determine the size of each object in the session?
Yes, if possible but maybe more like how many bits. The reading I have been doing since my post makes me think that I could serialize the session object and place in a byte, then get how many bytes in takes up. I can't make sense of the IO. Is this even possible? Thanks
It is possible to serialize all of the objects from the session and then check the sizes of each, but the size of an object after serialization is not necessarily the same as the size of the object in memory. It really depends upon what you're looking for. Are you looking for the size of the objects after serialization, or do you want the size of each object in memory? Corey
The size of each object in memory is what I am really looking for.
Joined: Dec 01, 2001
The Session object is unlimited in memory size theoratically but it depends upon your server memory. For more info see jguru servlet faq. Jawwad Ahmed SCJP SCWCD email@example.com
Joined: Dec 20, 2001
Originally posted by Anne Drew: The size of each object in memory is what I am really looking for.
Unfortunately, I don't think there is a way to know how large each object is in memory. Perhaps someone knows of a way, but I've been involved in a number of discussions about this and no one has ever been able to come up with a good solution. Corey