Search code examples
javahttpsession

Does session timeout get affected if session sharing is achieved between two java web application


If i share session(HTTPSession) of one java web application deployed and running on a dedicated machine in tomcat with other java web application deployed and running on a separate machine in tomcat, will the session time out get affected?

i mean if i jump from one app to another in a different browser window with the same session, will the first app timeout and vice versa?


Solution

  • Every session is managed by the underlying container, so two containers will not communicate to see if session should be timed out or not.

    So say your tomcat may timeout your session as per the configuration even if same session is being used in another container and is still active.

    Also it is not a recommended approach to share session between JVM's as not all containers will allow you to do that. I think WSAD allows you to do that, but instead of sharing session, I would suggest you to share objects instead.