/** {@inheritDoc} */ @Override public Map<String, Object> attributes() { // Even though discovery SPI removes this attribute after authentication, keep this check for safety. return F.view(attrs, new GridPredicate<String>() { @Override public boolean apply(String s) { return !GridNodeAttributes.ATTR_SECURITY_CREDENTIALS.equals(s); } }); }
/** {@inheritDoc} */ @Override public Collection<? extends GridNode> nodes() { return F.view(F.viewReadOnly(mappings.keySet(), U.id2Node(cctx.kernalContext())), F.notNull()); }
/** {@inheritDoc} */ @Override public Collection<? extends GridNode> nodes() { return F.view(F.viewReadOnly(mappings.keySet(), U.id2Node(cctx.kernalContext())), F.notNull()); }
/** * @return Reads. */ public Collection<GridCacheTxEntry<K, V>> reads() { return F.view(entries, CU.<K, V>reads()); }
/** * Gets collection of node for given node IDs and predicates. * * @param ids Ids to include. * @param p Filter for IDs. * @return Collection with all alive nodes for given IDs. */ public Collection<GridNode> nodes(@Nullable Collection<UUID> ids, GridPredicate<UUID>... p) { return F.isEmpty(ids) ? Collections.<GridNode>emptyList() : F.view( F.viewReadOnly(ids, U.id2Node(ctx), p), F.notNull()); }
/** * @param node Node to remove. */ public void removeMappedNode(GridNode node) { if (mappedDhtNodes.contains(node)) mappedDhtNodes = new ArrayList<>(F.view(mappedDhtNodes, F.notEqualTo(node))); if (mappedNearNodes != null && mappedNearNodes.contains(node)) mappedNearNodes = new ArrayList<>(F.view(mappedNearNodes, F.notEqualTo(node))); }
/** * @return Writes. */ public Collection<GridCacheTxEntry<K, V>> writes() { return F.view(entries, CU.<K, V>writes()); }
/** * @return Entries. */ public Collection<GridDhtCacheEntry<K, V>> entries() { return F.view(entries, F.notNull()); }
/** {@inheritDoc} */ @Override public Collection<GridNode> getRemoteNodes() { return new ArrayList<GridNode>(F.view(ring.remoteNodes(), VISIBLE_NODES)); }
/** * @param nodes Nodes. * @return Backup nodes. */ public static Collection<GridNode> backups(Collection<GridNode> nodes) { if (nodes == null || nodes.size() <= 1) return Collections.emptyList(); return F.view(nodes, F.notEqualTo(F.first(nodes))); }
/** * @param part Partition. * @param topVer Topology version. * @return Backup nodes. */ public Collection<GridNode> backups(int part, long topVer) { List<GridNode> nodes = nodes(part, topVer); assert !F.isEmpty(nodes); if (nodes.size() <= 1) return Collections.emptyList(); return F.view(nodes, F.notEqualTo(nodes.get(0))); }
/** {@inheritDoc} */ @Override protected Map<UUID, GridNodeMetrics> metrics0(Collection<UUID> nodeIds) { assert !F.isEmpty(nodeIds); return F.view(metricsMap, F.contains(nodeIds)); }
/** {@inheritDoc} */ @Override public Collection<GridCacheTxEntry<K, V>> recoveryWrites() { return F.view(writeEntries(), CU.<K, V>transferRequired()); }
/** {@inheritDoc} */ @Override public Collection<GridCacheTxEntry<K, V>> recoveryWrites() { return F.view(writeEntries(), CU.<K, V>transferRequired()); }
/** * @param p Partition. * @param topVer Topology version. * @return Nodes owning this partition. */ private Collection<GridNode> remoteOwners(int p, long topVer) { return F.view(top.owners(p, topVer), F.remoteNodes(cctx.nodeId())); }
/** * @param keys keys. * @param topVer Topology version. * @return Nodes for the keys. */ public Collection<GridNode> remoteNodes(Iterable<? extends K> keys, long topVer) { Collection<Collection<GridNode>> colcol = new GridLeanSet<>(); for (K key : keys) colcol.add(nodes(key, topVer)); return F.view(F.flatCollections(colcol), F.remoteNodes(cctx.localNodeId())); }
@Override public Collection<GridNode> remoteDaemonNodes() { final Collection<GridNode> all = ctx.discovery().daemonNodes(); return !localNode().isDaemon() ? all : F.view(all, new GridPredicate<GridNode>() { @Override public boolean apply(GridNode n) { return n.isDaemon(); } }); }
/** {@inheritDoc} */ @Override public Collection<String> getCacheNames() { Collection<String> names = F.view(super.getCacheNames(), new GridPredicate<String>() { @Override public boolean apply(String name) { return !F.eq(name, dataCacheName); } }); return F.concat(false, names, F.transform(metaCache.entrySetx(), new GridClosure<Map.Entry<MetaKey, Cache>, String>() { @Override public String apply(Map.Entry<MetaKey, Cache> e) { return e.getKey().name; } })); }
@Override public GridCacheReturn<V> applyx(Set<K> skipped, Exception e) throws GridException { if (e != null) throw U.cast(e); try { cctx.store().removeAllFromStore(GridCacheTxLocalAdapter.this, F.view(keys0, F0.not(F.contains(skipped)))); } catch (GridException ex) { throw new GridClosureException(ex); } return ret; } }));
@Override protected GridCacheReturn<V> postLock(GridCacheReturn<V> ret) throws GridException { if (log.isDebugEnabled()) log.debug("Acquired transaction lock for remove on keys: " + passedKeys); Set<K> failed = postLockWrite(passedKeys, loadFut.get(), null, null, ret, /*remove*/true, retval, filter); // Write-through. if (isSingleUpdate()) cctx.store().removeAllFromStore(GridCacheTxLocalAdapter.this, F.view(passedKeys, F.notIn(failed))); return ret; } };