/** * Flush the current value, including the margin, to disk. * * @param session the session */ public void flush(ServerSession session, long flushValueWithMargin) { if (session == null || !database.isSysTableLockedBy(session)) { // This session may not lock the sys table (except if it already has // locked it) because it must be committed immediately, otherwise // other threads can not access the sys table. ServerSession sysSession = database.getSystemSession(); synchronized (sysSession) { flushInternal(sysSession, flushValueWithMargin); sysSession.commit(false); } } else { synchronized (session) { flushInternal(session, flushValueWithMargin); } } }