/** * Checks entry for empty value. * * @param entry Entry to check. * @return {@code True} if entry is empty. */ private boolean empty(GridCacheEntry<K, V> entry) { try { return entry.peek(F.asList(GLOBAL)) == null; } catch (GridException e) { U.error(null, e.getMessage(), e); assert false : "Should never happen: " + e; return false; } }
/** @throws GridException If failed. */ public void testAffinity() throws GridException { Grid g1 = grid(1); Grid g2 = grid(2); assert caches(g1).size() == 0; assert F.first(caches(g2)).getCacheMode() == PARTITIONED; Map<GridNode, Collection<String>> map = g1.mapKeysToNodes(null, F.asList("1")); assertNotNull(map); assertEquals("Invalid map size: " + map.size(), 1, map.size()); assertEquals(F.first(map.keySet()), g2.localNode()); UUID id1 = g1.mapKeyToNode(null, "2").id(); assertNotNull(id1); assertEquals(g2.localNode().id(), id1); UUID id2 = g1.mapKeyToNode(null, "3").id(); assertNotNull(id2); assertEquals(g2.localNode().id(), id2); }
/** {@inheritDoc} */ @Override public GridFuture<?> addData(Map.Entry<K, V> entry) throws GridException, IllegalStateException { A.notNull(entry, "entry"); return addData(F.asList(entry)); }
/** * @param nodeId Node ID to send message to. * @param msg Message to send. * @throws GridException If send failed. */ private void send0(UUID nodeId, Object msg) throws GridException { GridNode node = ctx.kernalContext().discovery().node(nodeId); ctx.kernalContext().io().sendUserMessage(F.asList(node), msg, GridTopic.TOPIC_HADOOP, false, 0); }