/** * Characterization test: Note that the only way to increment {@code loadsCompleted} is to invoke * {@code endLoad}. */ @Test public void endLoadIncrementsMisses() { cachePerfStats.endLoad(0); assertThat(statistics.getInt(loadsCompletedId)).isEqualTo(1); }
/** * @param start the timestamp taken when the operation started */ @Override public void endLoad(long start) { // note that load times are used in health checks and // should not be disabled by enableClockStats==false // don't use getStatTime so always enabled long ts = NanoTimer.getTime(); this.stats.incLong(loadTimeId, ts - start); this.stats.incInt(loadsInProgressId, -1); this.stats.incInt(loadsCompletedId, 1); // need to think about timings this.cachePerfStats.endLoad(start); }
/** * Characterization test: {@code loads} currently wraps to negative from max integer value. */ @Test public void loadsCompletedWrapsFromMaxIntegerToNegativeValue() { statistics.incInt(loadsCompletedId, Integer.MAX_VALUE); cachePerfStats.endLoad(0); assertThat(cachePerfStats.getLoadsCompleted()).isNegative(); }
private Object doLocalLoad(CacheLoader loader, boolean netSearchAllowed, boolean preferCD) throws CacheLoaderException { Object obj = null; if (loader != null && !this.attemptedLocalLoad) { this.attemptedLocalLoad = true; CachePerfStats stats = region.getCachePerfStats(); LoaderHelper loaderHelper = this.region.loaderHelperFactory.createLoaderHelper(this.key, this.aCallbackArgument, netSearchAllowed, true /* netLoadAllowed */, this); long statStart = stats.startLoad(); try { obj = loader.load(loaderHelper); obj = this.region.getCache().convertPdxInstanceIfNeeded(obj, preferCD); } finally { stats.endLoad(statStart); } if (obj != null) { this.localLoad = true; } } return obj; }
value = callCacheLoader(loader, key, aCallbackArgument, preferCD); } finally { stats.endLoad(statStart);
replyWithException(e, dm); } finally { stats.endLoad(start);