/** * @return Set of internal cached entry representations. */ public final Iterable<? extends GridCacheEntryEx> allEntries() { return map.entries(ctx.cacheId()); }
Iterator<GridCacheMapEntry> entries = cache.map().entries(cache.context().cacheId()).iterator();
/** * @throws Exception If failed. */ @Test public void testCollocation() throws Exception { IgniteQueue<Integer> queue = grid(0).queue("queue", 0, config(true)); for (int i = 0; i < 1000; i++) assertTrue(queue.add(i)); assertEquals(1000, queue.size()); GridCacheContext cctx = GridTestUtils.getFieldValue(queue, "cctx"); UUID setNodeId = null; for (int i = 0; i < gridCount(); i++) { IgniteKernal grid = (IgniteKernal)grid(i); GridCacheAdapter cache = grid.context().cache().internalCache(cctx.name()); Iterator<GridCacheMapEntry> entries = cache.map().entries(cache.context().cacheId()).iterator(); if (entries.hasNext()) { if (setNodeId == null) setNodeId = grid.localNode().id(); else fail("For collocated queue all items should be stored on single node."); } } }}
/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { for (int i = 0; i < gridCount(); i++) { GridCacheAdapter<Object, Object> c = ((IgniteKernal)grid(i)).internalCache(DEFAULT_CACHE_NAME); for (GridCacheEntryEx e : c.map().entries(c.context().cacheId())) { Object key = e.key().value(c.context().cacheObjectContext(), false); Object val = CU.value(e.rawGet(), c.context(), false); if (key instanceof BinaryObject) assert ((BinaryObjectImpl)key).detached() : val; if (val instanceof BinaryObject) assert ((BinaryObjectImpl)val).detached() : val; } } IgniteCache<Object, Object> c = jcache(0); for (int i = 0; i < ENTRY_CNT; i++) c.remove(i); assertEquals(0, c.size()); }
/** * @return Set of internal cached entry representations. */ public final Iterable<? extends GridCacheEntryEx> allEntries() { return map.entries(ctx.cacheId()); }