/** {@inheritDoc} */ @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { g = (Grid)in.readObject(); cfg = g.configuration(); } }
/** 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; }
/** * 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; }
/** * @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; }
/** * @param g Grid. * @return Data transfer object for DR of given grid. */ public static VisorDr from(Grid g) { assert g != null; VisorDr dr = new VisorDr(); dr.id(g.configuration().getDataCenterId()); dr.senderHubInMetrics(VisorDrSenderHubInMetrics.map(g)); dr.senderHubAggregatedInMetrics(VisorDrSenderHubInMetrics.aggregated(g)); dr.senderHubOutMetrics(VisorDrSenderHubOutMetrics.map(g)); dr.senderHubAggregatedOutMetrics(VisorDrSenderHubOutMetrics.aggregated(g)); dr.receiverHubInMetrics(VisorDrReceiverHubInMetrics.map(g)); dr.receiverHubAggregatedInMetrics(VisorDrReceiverHubInMetrics.aggregated(g)); dr.receiverHubOutMetrics(VisorDrReceiverHubOutMetrics.aggregated(g)); return dr; }