开发者

How does session replication across containers work?

开发者 https://www.devze.com 2023-01-21 19:48 出处:网络
I would be interested in some timing details. For example I place in session some container, which can 开发者_如何学运维keep different data. I do change of content of the container frequently. How can

I would be interested in some timing details. For example I place in session some container, which can 开发者_如何学运维keep different data. I do change of content of the container frequently. How can I assure that the container session value get replicates across nodes for any change?


You don't need to make sure; that's the application server's job.

The J2EE specification doesn't deal with session-information synchronization amongst distributed components.

Theoretically, all you have to do is code thread-safe. In your example, simply make sure that access to the container is synchronized. If your application server is bug-free, then you can safely assume that the session information is properly replicated across all nodes in a seamless manner; if your application server has bugs around session synchronization... well... then nothing is really safe anymore, now is it.


Application servers use different strategies to synchronize session information between nodes. Session content can be considered as dirty and required synchronization at put data in session get data from session get data from session falls in two categories as get structured object get scalar object or immutable object So if session data get modified indirectly by modifying an structured object, then simple re-read it from session can assure that the object content got replicated.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号