Proper way to handle multiple injected @ConversationScoped beans

122 Views Asked by At

I am injecting multiple @ConversationScoped beans in one @ViewScoped bean and this has caused a lot of Conversation Locked issues.

To rectify this issue, in all the @ConversationScoped bean, I put lines of code to end the existing conversations before starting a new one.

As you can see when going into begin(), I will end all the previous conversations before starting a new one.

public void begin() {
   if (conversation != null
       && !conversation.isTransient()) {
           end();
   }

   if (conversation.isTransient()) {
      conversation.begin();
   }
}

Is this the proper way to do it ? Will this cause problems ?

0

There are 0 best solutions below