I have an application where two thread sometimes tries to access the same bean at the same time. The bean is managed and in session scope. This is what happens:
A: Access bean. Does not exist in session, created by jsf.
B: Access bean. Does not exist in session, created by jsf.
A: Bean added to session.
A: Put some data in the bean.
B: Bean added to session overwriting bean created by A!
B: Read some data from the bean.
C (in next call from client): Want to get the data put in the bean by A but instead gets bean created by B and the data is null!
How do I avoid this? Creation and session-putting is handled by the framework and so can not be synchronized (or can it)?