/** * Resolves coordinator. Nodes that are leaving or failed (but are still in * topology) are removed from search as well as provided filter. * * @param filter Nodes to exclude when resolving coordinator (optional). * @return Coordinator node or {@code null} if there are no coordinator * (i.e. local node is the last one and is currently stopping). */ @Nullable private GridTcpDiscoveryNode resolveCoordinator( @Nullable Collection<GridTcpDiscoveryNode> filter) { synchronized (mux) { Collection<GridTcpDiscoveryNode> excluded = F.concat(false, failedNodes, leavingNodes); if (!F.isEmpty(filter)) excluded = F.concat(false, excluded, filter); return ring.coordinator(excluded); } }
/** * @return Iterator over all entries. */ public Iterator<Map.Entry<GridSwapKey, byte[]>> entriesIterator() { final Iterator<ConcurrentMap<GridSwapKey, SwapValue>> iter = parts.values().iterator(); return transform(F.concat(new Iterator<Iterator<Map.Entry<GridSwapKey, SwapValue>>>() { @Override public boolean hasNext() { return iter.hasNext(); } @Override public Iterator<Map.Entry<GridSwapKey, SwapValue>> next() { return iter.next().entrySet().iterator(); } @Override public void remove() { throw new UnsupportedOperationException(); } })); }
/** {@inheritDoc} */ @Override public Collection<GridCacheTxEntry<K, V>> allEntries() { return F.concat(false, writeEntries(), readEntries()); }
/** {@inheritDoc} */ @Override public void addEvent(Object evt, Object... evts) throws GridException { A.notNull(evt, "evt"); if (!F.isEmpty(evts)) addEvents(F.concat(false, evt, Arrays.asList(evts))); else addEvents(Collections.singleton(evt)); }
/** {@inheritDoc} */ @Override public void addEventToStage(String stageName, Object evt, Object... evts) throws GridException { A.notNull(stageName, "stageName"); A.notNull(evt, "evt"); if (!F.isEmpty(evts)) addEventsToStage(stageName, F.concat(false, evt, Arrays.asList(evts))); else addEventsToStage(stageName, Collections.singleton(evt)); }
/** {@inheritDoc} */ @Override public final GridProjection forOthers(GridNode node, GridNode... nodes) { A.notNull(node, "node"); return forOthers(F.concat(false, node.id(), F.nodeIds(Arrays.asList(nodes)))); }
String[] commands = args; String cmd = F.concat(Arrays.asList(args), " ");
final Collection<GridNode> remotes = F.concat(false, spiCtx.remoteNodes(), spiCtx.remoteDaemonNodes());
/** {@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; } })); }
/** * @param req Request. * @throws GridException If failed. */ private void unmarshal(GridDistributedTxPrepareRequest<K, V> req) throws GridException { for (GridCacheTxEntry<K, V> e : F.concat(false, req.reads(), req.writes())) e.unmarshal(ctx, ctx.deploy().globalLoader()); }
selected = primaryId != null ? F.concat(false, primaryId, backupIds) : backupIds;
/** {@inheritDoc} */ @Override public void addRemoteCandidates( Map<K, Collection<GridCacheMvccCandidate<K>>> cands, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers) { for (GridCacheTxEntry<K, V> txEntry : F.concat(false, writeEntries(), readEntries())) { while (true) { GridDistributedCacheEntry<K, V> entry = (GridDistributedCacheEntry<K, V>)txEntry.cached(); try { // Handle explicit locks. GridCacheVersion base = txEntry.explicitVersion() != null ? txEntry.explicitVersion() : xidVer; Collection<GridCacheMvccCandidate<K>> entryCands = cands == null ? Collections.<GridCacheMvccCandidate<K>>emptyList() : cands.get(txEntry.key()); entry.addRemoteCandidates(entryCands, base, committedVers, rolledbackVers); break; } catch (GridCacheEntryRemovedException ignored) { assert entry.obsoleteVersion() != null; if (log.isDebugEnabled()) log.debug("Replacing obsolete entry in remote transaction [entry=" + entry + ", tx=" + this + ']'); // Replace the entry. txEntry.cached(cctx.cache().entryEx(txEntry.key()), entry.keyBytes()); } } } }
F.viewReadOnly(F.concat(false, reads, writes), CU.<K, V>tx2key()), tx.topologyVersion());
Collection<GridCacheTxEntry<K, V>> entries = groupLock() ? Collections.singletonList(groupLockEntry()) : F.concat(false, mapping.reads(), mapping.writes());
Collection<GridNode> allNodes = F.concat(false, ctx.discovery().allNodes(), ctx.discovery().daemonNodes());
Collection<Integer> parts = F.concat(false, cctx.affinity().primaryPartitions(exchId.nodeId(), moveTopVer), cctx.affinity().backupPartitions(exchId.nodeId(), moveTopVer));