void () { if (lastModCount == connection.records.getGlobalModCount()) { if (connection.isDirty() && !HeavyProcessLatch.INSTANCE.isRunning()) { try { connection.doForce(); } catch (AlreadyDisposedException | RejectedExecutionException e){ LOG.warn("Stop flushing: pool is shutting down or whole application is closing", e); scheduledFuture.cancel(false); } catch (Throwable t) { LOG.error("Unhandled exception during flush (reschedule regularly)", t); } } } lastModCount = connection.records.getGlobalModCount(); }