/** * @param grid Grid instance. * @param cacheName Name of the cache. * @return Instance on the named cache. * @throws GridException If cache not found. */ private static GridCacheProjectionEx<Object, Object> cache(Grid grid, String cacheName) throws GridException { GridCache<Object, Object> cache = grid.cache(cacheName); if (cache == null) throw new GridException( "Failed to find cache for given cache name (null for default cache): " + cacheName); return (GridCacheProjectionEx<Object, Object>)cache; }
/** {@inheritDoc} */ @Override public float getAverageWaitingJobs() { return node.metrics().getAverageWaitingJobs(); }
/** {@inheritDoc} */ @Override public double getLoad(GridNode node, int jobsSentSinceLastUpdate) { GridNodeMetrics metrics = node.metrics(); if (useAvg) { double load = metrics.getAverageActiveJobs() + metrics.getAverageWaitingJobs(); if (load > 0) return load; } double load = metrics.getCurrentActiveJobs() + metrics.getCurrentWaitingJobs(); return load < 0 ? 0 : load; }
/** {@inheritDoc} */ @Override public double getLoad(GridNode node, int jobsSentSinceLastUpdate) { GridNodeMetrics metrics = node.metrics(); double k = 1.0d; if (useProcs) { int procs = metrics.getTotalCpus(); if (procs > 1) k = procs * procCoefficient; } double load = (useAvg ? metrics.getAverageCpuLoad() : metrics.getCurrentCpuLoad()) / k; return load < 0 ? 0 : load; }
/** * @param node Node. * @return Current free heap. */ private long freeHeap(GridNode node) { final GridNodeMetrics m = node.metrics(); return m.getHeapMemoryMaximum() - m.getHeapMemoryUsed(); }
/** {@inheritDoc} */ @Override public void afterPropertiesSet() throws Exception { if (cfg == null) cfg = new GridConfiguration(); g = GridGainSpring.start(cfg, appCtx); }
/** {@inheritDoc} */ @Override public long getMaximumJobExecuteTime() { return node.metrics().getMaximumJobExecuteTime(); }
/** {@inheritDoc} */ @Override public int getMaximumRejectedJobs() { return node.metrics().getMaximumRejectedJobs(); }
/** {@inheritDoc} */ @Override public long getNonHeapMemoryCommitted() { return node.metrics().getNonHeapMemoryCommitted(); }
/** {@inheritDoc} */ @Override public double getCurrentGcCpuLoad() { return node.metrics().getCurrentGcCpuLoad() * 100; }
/** {@inheritDoc} */ @Override public long getTotalBusyTime() { return node.metrics().getTotalBusyTime(); }
/** {@inheritDoc} */ @Override public int getTotalRejectedJobs() { return node.metrics().getTotalRejectedJobs(); }
/** {@inheritDoc} */ @Override public long getSentBytesCount() { return node.metrics().getSentBytesCount(); }
/** {@inheritDoc} */ @Override public int getReceivedMessagesCount() { return node.metrics().getReceivedMessagesCount(); }
/** {@inheritDoc} */ @Override public long getCurrentJobWaitTime() { return node.metrics().getCurrentJobWaitTime(); }
/** {@inheritDoc} */ @Override public long getNonHeapMemoryUsed() { return node.metrics().getNonHeapMemoryUsed(); }
/** {@inheritDoc} */ @Override public long getTotalStartedThreadCount() { return node.metrics().getTotalStartedThreadCount(); }