/** {@inheritDoc} */ @Override public <K, V> GridCache<K, V> cache(String name) { assert g != null; return g.cache(name); }
/** {@inheritDoc} */ @Override public GridGgfs ggfs(String name) { assert g != null; return g.ggfs(name); }
/** {@inheritDoc} */ @Override public Collection<GridCache<?, ?>> caches() { assert g != null; return g.caches(); }
long qryId = qryIdGen.getAndIncrement(); GridCacheQueries<Object,Object> queries = g.cache(req.cacheName()).queries(); g.nodeLocalMap(); return fetchQueryResults(qryId, wrapper, locMap, g.localNode().id());
qry = qry.projection(grid.forLocal()); grid.nodeLocalMap().put(futId, t = F.t(fut, 0, false, cols)); Collection<String>>>nodeLocalMap().get(futId); grid.nodeLocalMap().put(futId, F.t(fut, totalCnt, true, cols)); else grid.nodeLocalMap().remove(futId); return first ? F.asList(grid.localNode().id(), futId, tbls, cols, types, fields, finished) : F.asList(fields, finished);
assert g != null; GridNodeLocalMap<String, Long> nl = g.nodeLocalMap(); Collection<GridEvent> evts = g.events().localQuery(p); res.add(new VisorGridEventsLost(g.localNode().id()));
/** Create data transfer objects for all caches. */ public static Map<String, VisorDrSenderHubInMetrics> map(Grid g) { assert g != null; GridDrSenderHubConfiguration cfg = g.configuration().getDrSenderHubConfiguration(); Map<String, VisorDrSenderHubInMetrics> map = new HashMap<>(); if (cfg != null) { GridDr dr = g.dr(); for (String cacheName : cfg.getCacheNames()) { GridDrSenderHubInMetrics m = dr.senderHubInMetrics(cacheName); if (m != null) map.put(cacheName, from(m)); } } return map; }
/** {@inheritDoc} */ @Nullable @Override public GridDr dr() { assert g != null; return g.dr(); }
/** * Sends optional message. If message is {@code null} - it's no-op. * * @param nodeId ID of the node to send message to. * @param respMsg Message to send. * @throws GridException Thrown in case of any errors. */ private void send(UUID nodeId, @Nullable Object respMsg) throws GridException { assert nodeId != null; if (respMsg != null) { GridNode node = grid.node(nodeId); if (node != null) grid.forNode(node).message().send(null, respMsg); // Can still fail. else throw new GridException("Failed to send message since destination node has " + "left topology (ignoring) [nodeId=" +nodeId + ", respMsg=" + respMsg + ']'); } }
/** {@inheritDoc} */ @Override public GridProjection forCache(String cacheName, @Nullable String... cacheNames) { assert g != null; return g.forCache(cacheName, cacheNames); }
/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { g = (Grid)in.readObject(); cfg = g.configuration(); } }
/** {@inheritDoc} */ @Override public GridProjection forHost(GridNode node) { assert g != null; return g.forHost(node); }
/** {@inheritDoc} */ @Override public GridProjection forLocal() { assert g != null; return g.forLocal(); }
/** {@inheritDoc} */ @Override public GridProjection forNode(GridNode node, GridNode... nodes) { assert g != null; return g.forNode(node, nodes); }
/** {@inheritDoc} */ @Override public GridEvents events() { assert g != null; return g.events(); }
/** * @param g Grid to take DR metrics. * @return Map with data transfer object for sender hub outgoing metrics for all configured remote data centers. */ public static Map<Byte, VisorDrSenderHubOutMetrics> map(Grid g) { assert g != null; GridDr dr = g.dr(); GridDrSenderHubConfiguration cfg = g.configuration().getDrSenderHubConfiguration(); Map<Byte, VisorDrSenderHubOutMetrics> map = new HashMap<>(); if (cfg != null) { for (GridDrSenderHubConnectionConfiguration c : cfg.getConnectionConfiguration()) { byte rmtDrId = c.getDataCenterId(); try { map.put(rmtDrId, from(dr.senderHubAggregatedOutMetrics(rmtDrId))); } catch (IllegalStateException | IllegalArgumentException ignored) { // No-op. } } } return map; }
/** Create data transfer object for aggregated metrics. */ public static VisorDrSenderHubInMetrics aggregated(Grid g) { assert g != null; GridDr dr = g.dr(); try { return from(dr.senderHubAggregatedInMetrics()); } catch (IllegalStateException ignored) { return null; } }
/** {@inheritDoc} */ @Override public GridProjection gridProjection() { return ctx.grid().forCache(name()); }
/** * Checks for explicit events configuration. * * @param g Grid instance. * @return {@code true} if all task events explicitly specified in configuration. */ public static boolean checkExplicitTaskMonitoring(Grid g) { int[] evts = g.configuration().getIncludeEventTypes(); if (F.isEmpty(evts)) return false; for (int evt : VISOR_TASK_EVTS) { if (!F.contains(evts, evt)) return false; } return true; }