how to use this in my own servlet, how to setHttpSession and getHttpSession
each time i have a new request on my servlet
and how will remove it if the session from the map when its no longer in use again
so is there auto timer for each session, so that it get deleted automatically from the hashmap,
when the given time period is reached and its no longer used by my servlet/server application
Your terminology is off. You are not adding or removing "sessions". There is only one session available to your servlet, and you are adding and removing "scoped variables", also called "attributes", to it.
I'm not really understanding what your question is. You can add or remove scoped variables to the session any time you like. All scoped variables in the session will automatically be removed if the session times out.