/** * Gets metrics map. * * @return Metrics map. */ public Map<UUID, GridNodeMetrics> metrics() { return F.viewReadOnly(metrics, new C1<byte[], GridNodeMetrics>() { @Override public GridNodeMetrics apply(byte[] metricsBytes) { return GridDiscoveryMetricsHelper.deserialize(metricsBytes, 0); } }); }
/** * @return Collection of active endpoints. */ public Collection<GridIpcServerEndpoint> endpoints() { return F.viewReadOnly(srvrs, new C1<GridGgfsServer, GridIpcServerEndpoint>() { @Override public GridIpcServerEndpoint apply(GridGgfsServer e) { return e.getIpcServerEndpoint(); } }); }
/** * @param col Collection. * @return Collection with masked {@code null} values. */ private Collection<Object> maskNulls(Collection<Object> col) { assert col != null; return F.viewReadOnly(col, new C1<Object, Object>() { @Override public Object apply(Object e) { return e != null ? e : NULL; } }); }
/** * @return Collection of active endpoints. */ public Collection<GridIpcServerEndpoint> endpoints() { return F.viewReadOnly(srvrs, new C1<GridGgfsServer, GridIpcServerEndpoint>() { @Override public GridIpcServerEndpoint apply(GridGgfsServer e) { return e.getIpcServerEndpoint(); } }); }
/** * @param col Collection. * @return Collection with unmasked {@code null} values. */ private Collection<Object> unmaskNulls(Collection<Object> col) { assert col != null; return F.viewReadOnly(col, new C1<Object, Object>() { @Override public Object apply(Object e) { return e != NULL ? e : null; } }); }
/** * Gets currently used deployments. * * @return Currently used deployments. */ public Collection<GridDeployment> getUsedDeployments() { return F.viewReadOnly(tasks.values(), new C1<GridTaskWorker<?, ?>, GridDeployment>() { @Override public GridDeployment apply(GridTaskWorker<?, ?> w) { return w.getDeployment(); } }); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public Collection<GridGgfs> ggfss() { return F.viewReadOnly(ggfsCache.values(), CTX_TO_GGFS); }
/** * Converts collection of Grid instances to collection of node IDs. * * @param grids Grids. * @return Node IDs. */ public static Collection<UUID> gridIds(@Nullable Collection<? extends Grid> grids) { return F.viewReadOnly(grids, new C1<Grid, UUID>() { @Override public UUID apply(Grid g) { return g.localNode().id(); } }); }
/** {@inheritDoc} */ @Override public Collection<String> getCacheNames() { assert grid != null; return F.viewReadOnly(grid.caches(), new GridClosure<GridCache<?, ?>, String>() { @Override public String apply(GridCache<?, ?> c) { return c.name(); } }); } }
/** * @return Involved nodes. */ @Override public Collection<? extends GridNode> nodes() { return F.viewReadOnly(futures(), new GridClosure<GridFuture<?>, GridNode>() { @Nullable @Override public GridNode apply(GridFuture<?> f) { if (isMini(f)) return ((MiniFuture)f).node(); return cctx.discovery().localNode(); } }); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public Collection<? extends GridNode> nodes() { return F.viewReadOnly(futures(), new GridClosure<GridFuture<Map<K, V>>, GridNode>() { @Nullable @Override public GridNode apply(GridFuture<Map<K, V>> f) { if (isMini(f)) return ((MiniFuture)f).node(); return cctx.discovery().localNode(); } }); }
/** * Returns only directly available nodes from given collection. * * @param nodes Nodes. * @return Directly available subset. */ protected static Collection<GridClientNode> selectDirectNodes(Collection<? extends GridClientNode> nodes) { return F.viewReadOnly(nodes, F.<GridClientNode>identity(), CONNECTABLE); } }
/** * @return Readers. * @throws GridCacheEntryRemovedException If removed. */ public Collection<UUID> readers() throws GridCacheEntryRemovedException { return F.viewReadOnly(checkReaders(), R2N); }
/** * @return Participating nodes. */ @Override public Collection<? extends GridNode> nodes() { return F.viewReadOnly(futures(), new GridClosure<GridFuture<?>, GridNode>() { @Nullable @Override public GridNode apply(GridFuture<?> f) { if (isMini(f)) return ((MiniFuture)f).node(); return cctx.discovery().localNode(); } }); }
/** * @return Participating nodes. */ @Override public Collection<? extends GridNode> nodes() { return F.viewReadOnly(futures(), new GridClosure<GridFuture<?>, GridNode>() { @Nullable @Override public GridNode apply(GridFuture<?> f) { if (isMini(f)) return ((MiniFuture)f).node(); return cctx.discovery().localNode(); } }); }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(GridCacheMultiTxFuture.class, this, "txs", F.viewReadOnly(txs, CU.<K, V>tx2xidVersion()), "remaining", F.viewReadOnly(remainingTxs, CU.<K, V>tx2xidVersion()), "super", super.toString() ); } }
/** {@inheritDoc} */ @Override public GridDhtPartitionMap localPartitionMap() { lock.readLock().lock(); try { return new GridDhtPartitionMap(cctx.nodeId(), updateSeq.get(), F.viewReadOnly(locParts, CU.<K, V>part2state()), true); } finally { lock.readLock().unlock(); } }
/** {@inheritDoc} */ @Override public void clear() { ctx.cache().clearAll0(F.viewReadOnly(map.values(), F.<K>mapEntry2Key(), filter), CU.<K, V>empty()); map.clear(); }
/** {@inheritDoc} */ @Override public void clear() { ctx.cache().clearAll0(F.viewReadOnly(set, F.<K>mapEntry2Key(), filter), CU.<K, V>empty()); set.clear(); }
/** {@inheritDoc} */ @Override public Collection<? extends GridNode> nodes() { return F.view(F.viewReadOnly(mappings.keySet(), U.id2Node(cctx.kernalContext())), F.notNull()); }