I am using a CDI bean with conversation scope. I start a new conversation in a action method of my bean like this:
if (conversation.isTransient()) {
conversation.begin();
logger.fine("start new conversation, id=" + conversation.getId());
}
Now I recognized, that the IDs given by CDI are simple small numbers like '1' or '2' and so on. I was able, after some testing, to start different browser sessions which got at the end the same ID. So both browsers claim the id '1' for example. And this results in a conflict during the conversation.
I wonder if this behavior is normal (I am running in Wildfly)?
Should I begin my conversation by giving a generated unique id by myself?
if (conversation.isTransient()) {
conversation.begin(UUID.randomUUID().toString());
logger.fine("start new conversation, id=" + conversation.getId());
}
Update: As Siliarus comment, the ID is unique in the browser session. My own observation of a conflict in two different browser sessions, using the same CID, was wrong. There is no need to create a unique id by myself.