Concurrency aggregate modification exception and SQL integrity exception

Hi Allard,
In our case we extend from AbstractAnnotatedAggregateRoot with proper routing strategy. But this is observed in our case that when we have two instances of application is running, we often we get Concurrency Modification exception. JGroups using AnnotationRoutingStrategy is used for load distribution.

Also sometimes it is observed that request takes little longer time to reach to proper node for processing .

Can you please suggest how to fix this issue?

Thanks,
Vijaya

Do you have any suggestions on this.
During processing we see request processing is done by proper application node/ instance based on routing key. Still we this concurrency modification exception.
Does this exception has any major impact on the application/ db processing.

Hi Vijaya,

did you check the isolation level of your JDBC connection? Many databases default to “repeatable read”, which can cause this, even with the proper locks in place. The problem is that the lock is obtained with an active connection. When the lock is free, the connection was already started and may not see the changes made in the meantime.

The best setting, in my experience, is READ_COMMITTED.

Cheers,

Allard