Handle the given auto-flush event.
final EventSource source = event.getSession();
if ( flushMightBeNeeded(source) ) {
final int oldSize = source.getActionQueue().numberOfCollectionRemovals();
flushEverythingToExecutions(event);
if ( flushIsReallyNeeded(event, source) ) {
log.trace("Need to execute flush");
performExecutions(source);
postFlush(source);
// note: performExecutions() clears all collectionXxxxtion
// collections (the collection actions) in the session
if ( source.getFactory().getStatistics().isStatisticsEnabled() ) {
source.getFactory().getStatisticsImplementor().flush();
}
}
else {
log.trace("Dont need to execute flush");
source.getActionQueue().clearFromFlushNeededCheck( oldSize );
}
event.setFlushRequired( flushIsReallyNeeded( event, source ) );
}