/** {@inheritDoc} */ @Override public <V> V removeMeta(String name) { assert impl != null; return impl.removeMeta(name); }
/** {@inheritDoc} */ @Override public <V> boolean removeMeta(String name, V val) { assert impl != null; return impl.removeMeta(name, val); }
/** {@inheritDoc} */ @Override public void onEntryAccessed(boolean rmv, GridCacheEntry<K, V> entry) { if (!rmv) { if (!entry.isCached()) return; if (touch(entry)) shrink(); } else { Node<GridCacheEntry<K, V>> node = entry.removeMeta(meta); if (node != null) queue.unlinkx(node); } }
/** {@inheritDoc} */ @Override public void onEntryAccessed(boolean rmv, GridCacheEntry<K, V> entry) { if (!rmv) { if (!entry.isCached()) return; // Shrink only if queue was changed. if (touch(entry)) shrink(); } else { Node<GridCacheEntry<K, V>> node = entry.removeMeta(meta); if (node != null) queue.unlinkx(node); } }
/** * Shrinks FIFO queue to maximum allowed size. */ private void shrink() { int max = this.max; int startSize = queue.sizex(); for (int i = 0; i < startSize && queue.sizex() > max; i++) { GridCacheEntry<K, V> entry = queue.poll(); if (entry == null) break; if (!entry.evict()) { entry.removeMeta(meta); touch(entry); } } }
/** {@inheritDoc} */ @Override public void onEntryAccessed(boolean rmv, GridCacheEntry<GridGgfsBlockKey, byte[]> entry) { if (!rmv) { if (!entry.isCached()) return; if (touch(entry)) shrink(); } else { MetaEntry meta = entry.removeMeta(META_NODE); if (meta != null && queue.unlinkx(meta.node())) changeSize(-meta.size()); } }
/** {@inheritDoc} */ @Override public void onEntryAccessed(boolean rmv, GridCacheEntry<GridGgfsBlockKey, byte[]> entry) { if (!rmv) { if (!entry.isCached()) return; if (touch(entry)) shrink(); } else { MetaEntry meta = entry.removeMeta(META_NODE); if (meta != null && queue.unlinkx(meta.node())) changeSize(-meta.size()); } }
/** * Shrinks queue to maximum allowed size. */ private void shrink() { int max = this.max; int startSize = queue.sizex(); for (int i = 0; i < startSize && queue.sizex() > max; i++) { GridCacheEntry<K, V> entry = queue.poll(); if (entry == null) break; if (!entry.evict()) { entry.removeMeta(meta); touch(entry); } } }
/** * Shrinks queue to maximum allowed size. */ private void shrink() { long maxSize = this.maxSize; int maxBlocks = this.maxBlocks; int cnt = queue.sizex(); for (int i = 0; i < cnt && (maxBlocks > 0 && queue.sizex() > maxBlocks || maxSize > 0 && curSize.longValue() > maxSize); i++) { GridCacheEntry<GridGgfsBlockKey, byte[]> entry = queue.poll(); if (entry == null) break; // Queue is empty. byte[] val = entry.peek(); if (val != null) changeSize(-val.length); // Change current size as we polled entry from the queue. if (!entry.evict()) { // Reorder entries which we failed to evict. entry.removeMeta(META_NODE); touch(entry); } } }
else if (!entry.removeMeta(meta, node)) return false;
/** * Shrinks queue to maximum allowed size. */ private void shrink() { long maxSize = this.maxSize; int maxBlocks = this.maxBlocks; int cnt = queue.sizex(); for (int i = 0; i < cnt && (maxBlocks > 0 && queue.sizex() > maxBlocks || maxSize > 0 && curSize.longValue() > maxSize); i++) { GridCacheEntry<GridGgfsBlockKey, byte[]> entry = queue.poll(); if (entry == null) break; // Queue is empty. byte[] val = entry.peek(); if (val != null) changeSize(-val.length); // Change current size as we polled entry from the queue. if (!entry.evict()) { // Reorder entries which we failed to evict. entry.removeMeta(META_NODE); touch(entry); } } }
else if (!entry.removeMeta(meta, node)) return false;
else if (!entry.removeMeta(META_NODE, node)) return false;
else if (!entry.removeMeta(META_NODE, node)) return false;