setMaxInactiveInterval(int interval)
Set a session timeout interval, in seconds, as an integer, overriding any default in the
servlet container or set through the web.xml <session-timeout> element. A negative value indicates no timeout. A value of 0 results in an immediate timeout
If you want to time out otherwise use session.invalidate()
You can check with isNew() to identify the session or comparing id's by getId()