ByteBuffer (@NotNull PageImpl pageToUnmap) { if (!pageToUnmap.isPreTombstone()) { throw new AssertionError("Bug: page must be PRE_TOMBSTONE: " + pageToUnmap); } if (pageToUnmap.isDirty()) { //MAYBE RC: flush() is better be off-loaded to IO thread pool, instead of slowing down housekeeper // thread? try { pageToUnmap.flush(); } catch (IOException e) { throw new UncheckedIOException("Can't flush page: " + pageToUnmap, e); } } ByteBuffer pageBuffer = pageToUnmap.detachTombstoneBuffer(); pageToUnmap.entomb(); return pageBuffer; }