@Override public void close(Throwable cause) throws IOException { close(cause, false); }
@Override public void close(Throwable cause) throws IOException { close(cause, false); }
@Override protected void finalize() throws IOException { close(); }
@Override public void close(Throwable cause) throws IOException { close(cause, false); }
private void panic(Throwable cause) { try { getDatabase().close(cause); } catch (Throwable e) { // Ignore. } }
private void panic(Throwable cause) { try { getDatabase().close(cause); } catch (Throwable e) { // Ignore. } }
@Override public void shutdown() throws IOException { close(null, mPageDb.isDurable()); }
private void panic(Throwable cause) { try { getDatabase().close(cause); } catch (Throwable e) { // Ignore. } }
@Override public void shutdown() throws IOException { close(null, mPageDb.isDurable()); }
@Override public void shutdown() throws IOException { close(null, mPageDb.isDurable()); }
/** * Mark an unmapped node as dirty. Caller must hold commit lock and exclusive latch on * node. Method does nothing if node is already dirty. Latch is never released by this * method, even if an exception is thrown. */ void markUnmappedDirty(Node node) throws IOException { if (node.mCachedState != mCommitState) { node.write(mPageDb); long newId = mPageDb.allocPage(); long oldId = node.mId; try { mPageDb.deletePage(oldId); } catch (Throwable e) { try { mPageDb.recyclePage(newId); } catch (Throwable e2) { // Panic. e.addSuppressed(e2); close(e); } throw e; } dirty(node, newId); } }
/** * @param nodeId can be zero */ void deleteFragment(long nodeId) throws IOException { if (nodeId != 0) { Node node = nodeMapGetAndRemove(nodeId); if (node != null) { deleteNode(node); } else try { if (mInitialReadState != CACHED_CLEAN) { // Page was never used if nothing has ever been checkpointed. mPageDb.recyclePage(nodeId); } else { // Page is clean if not in a Node, and so it must survive until after the // next checkpoint. Must force the delete, because by this point, the // caller can't easily clean up. mPageDb.deletePage(nodeId, true); } } catch (Throwable e) { // Panic. close(e); throw e; } } }
/** * Mark an unmapped node as dirty. Caller must hold commit lock and exclusive latch on * node. Method does nothing if node is already dirty. Latch is never released by this * method, even if an exception is thrown. */ void markUnmappedDirty(Node node) throws IOException { if (node.mCachedState != mCommitState) { node.write(mPageDb); long newId = mPageDb.allocPage(); long oldId = node.mId; try { mPageDb.deletePage(oldId); } catch (Throwable e) { try { mPageDb.recyclePage(newId); } catch (Throwable e2) { // Panic. Utils.suppress(e, e2); close(e); } throw e; } dirty(node, newId); } }
node.releaseExclusive(); close(e); throw e;
/** * Mark an unmapped node as dirty. Caller must hold commit lock and exclusive latch on * node. Method does nothing if node is already dirty. Latch is never released by this * method, even if an exception is thrown. */ void markUnmappedDirty(Node node) throws IOException { if (node.mCachedState != mCommitState) { node.write(mPageDb); long newId = mPageDb.allocPage(); long oldId = node.mId; try { // No need to force delete when dirtying. Caller is responsible for cleaning up. mPageDb.deletePage(oldId, false); } catch (Throwable e) { try { mPageDb.recyclePage(newId); } catch (Throwable e2) { // Panic. Utils.suppress(e, e2); close(e); } throw e; } dirty(node, newId); } }
db.close(e); throw e; } finally {