I just wanted to know that whether the output of printing the session object like
System.out.println(sessiononject);
will return the creation time of the session. I’m storing the session object in a static hash map and getting it back from the map and when I’m printing it, I’m getting the created time of the session. But, I’m not getting the time always. Just check the following output while browsing the application in various system and browser.
{2F41393827EA02BB912CDCC194C42398.PicoEMS1=1326098069115,
46E427BAA0B42D8E1E27C533C32DB977.PicoEMS1=1325858091647,
4D4CF0A25E1A5F72AA45F5515C4FA819.PicoEMS1=1326100008712,
5D2A80DE7C8EEEA203EE0B1512F78829.PicoEMS1=1325856576256,
376D666C75324C1537A6B213252237EF.PicoEMS1=1325856598874,
9391A162E03ED4ED4E955C742D65A2A5.PicoEMS1=1326098775911,
5DCDF4A60B752961CBB19C0DB409F0D8.PicoEMS1=org.apache.catalina.session.StandardSessionFacade@78e2e186, AEA530F9F9AAC4B7E5DA8BC186E0DA27.PicoEMS1=1326090775861,
5059EA4503876B7090F860DCF656A7E2.PicoEMS1=1326090718239,
6D211D34CE2E868497A1FE5BA49EA099.PicoEMS1=org.apache.catalina.session.StandardSessionFacade@26948cb9, B131BA54A0ECB610C3A17474FD170136.PicoEMS1=1326097413641,
1F9114E0449141476DAD3414B1970D54.PicoEMS1=1326090779510,
5B088728E4D538322D467C8CD30DACFB.PicoEMS1=1326097184254,
DAA2BF5FBE5EC978515C54286D926821.PicoEMS1=1325857115881,
A9D8316862274DB662A3D667EB58B1D5.PicoEMS1=org.apache.catalina.session.StandardSessionFacade@3cff49ab, DC89F419C17A85C5C19199F7920F7DB7.PicoEMS1=1325858502804,
45993E1463023E4012F23502E65C7FAB.PicoEMS1=org.apache.catalina.session.StandardSessionFacade@e32dec9,
B22C74666E9C8FEF3032D7CFD3D082E9.PicoEMS1=1326099308589,
CA752CF89E312252EA9DE17E9F97DA02.PicoEMS1=1326089242002,
0BC1E77C07BB8FAE68C83EBC09A4D9AC.PicoEMS1=1325857788710,
564F44ADECF7E9E5B159413E6D887B9D.PicoEMS1=1325858173676,
640AC2C85C0769A43810A4CA7B259F9B.PicoEMS1=1326089213514,
B7EE7FA8EF8EE03E34577484A5EA139F.PicoEMS1=1326098769596,
A878787663A83AC6F1BC8E22D2CB70D5.PicoEMS1=1325857982977}
The above lines is the session objects stored in static hash map.
This is inconsistency to use the creation time for finding last access time.
HttpSession is an interface, there is no specified behaviour for its toString method. Since you can’t count on the application server using any particular implementation of it at any given time or in any given version, depending on the output of its toString for your program’s correctness ia a bad idea! As you are observing, you’re seeing two different implementations of it in your Map.