With the current implementation, we use set() at DomainEventDispatcher, hence there is non-deterministic order of execution domain event’s handlers. It can lead to deadlock.
For example, if we have 2 handlers on the domain event, which insert a row to the according tables, and if execution order between transactions is different, then there is a deadlock on insert statement: transaction 1 inserts to first table and waits for the lock at second table, and simultaneously transaction 2 inserts to second table and waits for lock at first table.
Set() has been replaced by List with "already exist" check.
With the current implementation, we use set() at DomainEventDispatcher, hence there is non-deterministic order of execution domain event’s handlers. It can lead to deadlock.
For example, if we have 2 handlers on the domain event, which insert a row to the according tables, and if execution order between transactions is different, then there is a deadlock on insert statement: transaction 1 inserts to first table and waits for the lock at second table, and simultaneously transaction 2 inserts to second table and waits for lock at first table.
Set() has been replaced by List with "already exist" check.