The same class is used for FlushEventListener and AutoFlushEventListener. So this Object can be an AuoFlushEventListener or a FlushEventListener.

What happens is that if there is another event listener registered we first called the prepareBatch() method in the dialect, then we wait for the execution of the other evetnListener and at the end we execute the batched operations.

I admit that I haven't looked to much into this class, I have just kept it the way it was originally.