/** * _Tree instances retain a reference to an unevictable root node. If tree is no longer in * use, allow it to be evicted. Method cannot be called while a checkpoint is in progress. */ private void cleanupUnreferencedTrees() throws IOException { final ReferenceQueue<_Tree> queue = mOpenTreesRefQueue; if (queue == null) { return; } try { while (true) { Reference<? extends _Tree> ref = queue.poll(); if (ref == null) { break; } if (ref instanceof _TreeRef) { cleanupUnreferencedTree((_TreeRef) ref); } } } catch (Exception e) { if (!mClosed) { throw e; } } }
/** * _Tree instances retain a reference to an unevictable root node. If tree is no longer in * use, allow it to be evicted. Method cannot be called while a checkpoint is in progress. */ private void cleanupUnreferencedTrees() throws IOException { final ReferenceQueue<_Tree> queue = mOpenTreesRefQueue; if (queue == null) { return; } try { while (true) { Reference<? extends _Tree> ref = queue.poll(); if (ref == null) { break; } if (ref instanceof _TreeRef) { cleanupUnreferencedTree((_TreeRef) ref); } } } catch (Exception e) { if (!isClosed()) { throw e; } } }
/** * _Tree instances retain a reference to an unevictable root node. If tree is no longer in * use, allow it to be evicted. Method cannot be called while a checkpoint is in progress. */ private void cleanupUnreferencedTrees() throws IOException { final ReferenceQueue<_Tree> queue = mOpenTreesRefQueue; if (queue == null) { return; } try { while (true) { Reference<? extends _Tree> ref = queue.poll(); if (ref == null) { break; } if (ref instanceof _TreeRef) { cleanupUnreferencedTree((_TreeRef) ref); } } } catch (Exception e) { if (!isClosed()) { throw e; } } }
/** * @param name required (cannot be null) * @return null if not found */ private _Tree quickFindIndex(byte[] name) throws IOException { _TreeRef treeRef; mOpenTreesLatch.acquireShared(); try { treeRef = mOpenTrees.get(name); if (treeRef == null) { return null; } _Tree tree = treeRef.get(); if (tree != null) { return tree; } } finally { mOpenTreesLatch.releaseShared(); } // Ensure that root node of cleared tree reference is available in the node map before // potentially replacing it. Weak references are cleared before they are enqueued, and // so polling the queue does not guarantee node eviction. Process the tree directly. cleanupUnreferencedTree(treeRef); return null; }
/** * @param name required (cannot be null) * @return null if not found */ private _Tree quickFindIndex(byte[] name) throws IOException { _TreeRef treeRef; mOpenTreesLatch.acquireShared(); try { treeRef = mOpenTrees.get(name); if (treeRef == null) { return null; } _Tree tree = treeRef.get(); if (tree != null) { return tree; } } finally { mOpenTreesLatch.releaseShared(); } // Ensure that root node of cleared tree reference is available in the node map before // potentially replacing it. Weak references are cleared before they are enqueued, and // so polling the queue does not guarantee node eviction. Process the tree directly. cleanupUnreferencedTree(treeRef); return null; }
/** * @param name required (cannot be null) * @return null if not found */ private _Tree quickFindIndex(byte[] name) throws IOException { _TreeRef treeRef; mOpenTreesLatch.acquireShared(); try { treeRef = mOpenTrees.get(name); if (treeRef == null) { return null; } _Tree tree = treeRef.get(); if (tree != null) { return tree; } } finally { mOpenTreesLatch.releaseShared(); } // Ensure that root node of cleared tree reference is available in the node map before // potentially replacing it. Weak references are cleared before they are enqueued, and // so polling the queue does not guarantee node eviction. Process the tree directly. cleanupUnreferencedTree(treeRef); return null; }