I have implemented a circuit breaker pattern in my java EE application and since it holds a state(how many failed requests, average response time, locked/unlocked and so on) I've set inte to be @Stateful
.
And to avoid having issues with it being serialized because of container locking I've added @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
and made sure that all operations are thread safe.
So it currently looks like this:
@Stateful
@ConcurrencyManagement(ConcurrencyManagementType.BEAN)
public class CatalogBreaker extends Breaker {
but I am still getting.
Caused by: javax.ejb.ConcurrentAccessTimeoutException: WFLYEJB0228: EJB 3.1 FR 4.3.14.1 concurrent access timeout on CatalogBreaker - could not obtain lock within 5000 MILLISECONDS
But if I understand everything correctly the CuncurrencyManagement
annotation should delegate locking to the bean and not the container... and since the CatalogBreaker
does not have any locks or anything of the sort, then how come I am getting this error?