How to control that a method of stateless session bean is executed one at a time?

136 Views Asked by At

Our Weblogic server runs with EJB2.1. Our application gets it requests from messages. If multiple messages come in, concerning the same entity (it does not matter), a method from a stateless method is called multiple times, and they run in parallel. How can I prevent this, so what should I do so they run after each other?

1

There are 1 best solutions below

0
devwebcl On

The EJB bean in your EJB container supposes to run in parallel.

The only way I see is to set max-beans-in-free-pool to one bean in your weblogic-ejb-jar.xml, but this will affect your performance drastically. https://docs.oracle.com/cd/E17904_01/web.1111/e13719/ejb_jar_ref.htm#EJBPG656

On the other hand, you may migrate to Singleton EJB that exists from EE6 (EJB3.1), but migrating your EJBs from 2.1 to 3.1 is a long (hard) task.