Source:
private synchronized void closeOpenFilesAndUnlock(boolean flush) { try { stopWriter(); if (pageStore != null) { if (flush) { try { pageStore.checkpoint(); if (!readOnly) { lockMeta(pageStore.getPageStoreSession()); pageStore.compact(compactMode); unlockMeta(pageStore.getPageStoreSession()); } } catch (DbException e) { if (ASSERT) { int code = e.getErrorCode(); if (code != ErrorCode.DATABASE_IS_CLOSED && code != ErrorCode.LOCK_TIMEOUT_1 && code != ErrorCode.IO_EXCEPTION_2) { e.printStackTrace(); } } trace.error(e, "close"); } catch (Throwable t) { if (ASSERT) { t.printStackTrace(); } trace.error(t, "close"); } } } reconnectModified(false); if (store != null && store.getMvStore() != null && !store.getMvStore().isClosed()) { long maxCompactTime = dbSettings.maxCompactTime; if (compactMode == CommandInterface.SHUTDOWN_COMPACT || compactMode == CommandInterface.SHUTDOWN_DEFRAG || getSettings().defragAlways) { maxCompactTime = Long.MAX_VALUE; } else { store.compactFile(dbSettings.maxCompactTime); } store.close(maxCompactTime); } if (systemSession != null) { systemSession.close(); systemSession = null; } if (lobSession != null) { lobSession.close(); lobSession = null; } closeFiles(); if (persistent && lock == null && fileLockMethod != FileLockMethod.NO && fileLockMethod != FileLockMethod.FS) { return; } if (persistent) { deleteOldTempFiles(); } } finally { if (lock != null) { if (fileLockMethod == FileLockMethod.SERIALIZED) { if (lock.load().containsKey("changePending")) { try { Thread.sleep(TimeUnit.NANOSECONDS .toMillis((long) (reconnectCheckDelayNs * 1.1))); } catch (InterruptedException e) { trace.error(e, "close"); } } } lock.unlock(); lock = null; } } }

Target:
private synchronized void closeOpenFilesAndUnlock(boolean flush) { try { stopWriter(); if (pageStore != null) { if (flush) { try { pageStore.checkpoint(); if (!readOnly) { lockMeta(pageStore.getPageStoreSession()); pageStore.compact(compactMode); unlockMeta(pageStore.getPageStoreSession()); } } catch (DbException e) { if (ASSERT) { int code = e.getErrorCode(); if (code != ErrorCode.DATABASE_IS_CLOSED && code != ErrorCode.LOCK_TIMEOUT_1 && code != ErrorCode.IO_EXCEPTION_2) { e.printStackTrace(); } } trace.error(e, "close"); } catch (Throwable t) { if (ASSERT) { t.printStackTrace(); } trace.error(t, "close"); } } } reconnectModified(false); if (store != null) { MVStore mvStore = store.getMvStore(); if (mvStore != null && !mvStore.isClosed()) { boolean compactFully = compactMode == CommandInterface.SHUTDOWN_COMPACT || compactMode == CommandInterface.SHUTDOWN_DEFRAG || getSettings().defragAlways; if (!compactFully && !mvStore.isReadOnly()) { try { store.compactFile(dbSettings.maxCompactTime); } catch (Throwable t) { trace.error(t, "compactFile"); } } store.close(compactFully); } } if (systemSession != null) { systemSession.close(); systemSession = null; } if (lobSession != null) { lobSession.close(); lobSession = null; } closeFiles(); if (persistent && lock == null && fileLockMethod != FileLockMethod.NO && fileLockMethod != FileLockMethod.FS) { return; } if (persistent) { deleteOldTempFiles(); } } finally { if (lock != null) { if (fileLockMethod == FileLockMethod.SERIALIZED) { if (lock.load().containsKey("changePending")) { try { Thread.sleep(TimeUnit.NANOSECONDS .toMillis((long) (reconnectCheckDelayNs * 1.1))); } catch (InterruptedException e) { trace.error(e, "close"); } } } lock.unlock(); lock = null; } } }