• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we implement our own session object for Session tracking?  RSS feed

 
lakshmana dhanimireddi
Greenhorn
Posts: 18
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Can we implement use defind session management. If we can, What will be the performance of the application.

Thanks.
 
Balaji Vankadaru
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its not possible to Implement your own session object. Its maintained and created by the container which hosts the application.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean exactly but definitely you can employ other techniques for session management.
For example you can store your session data in RDBMS or even in NoSQL solution like Redis or Riak (both are really convenient for this scenario).
 
Ivan Jozsef Balazs
Rancher
Posts: 999
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are not happy with the session management provided by the servlet container for some reason, you can try to roll out your own one. This might prove to be a tedious business though.

Why do you think you need this? Is there some special consideration/requirement?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. But as has been pointed out you will not be using any of the built in session capabilities.

Advantages - you control everything, you don't have to be dependent on cookies or url rewrite

Disadvantages - you have to write everthing, including some way to create a unique id and associate it with a particular user

Precautions: for any substantial load of users / size of objects stored, you will need a serialization mechanims - keep those objects Serializable.

Performance advantage: Probably not measurable or slower.

Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why?
 
lakshmana dhanimireddi
Greenhorn
Posts: 18
Java Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you to all

Actually I have requirement to replace the default session management to user defined session management.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lakshmana dhanimireddi wrote:Thank you to all

Actually I have requirement to replace the default session management to user defined session management.


Exactly what will your users want to define?

For session lifetime the built in HttpSession setMaxInactiveInterval gives you some control.

For persisting data over periods longer than a single web browser session, the usual approach is some sort of database, not extremely long session lifetimes.

Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!