/** * Characterization test: Note that the only way to increment {@code getTime} is to invoke * {@code endGet}. */ @Test public void endGetIncrementsGetTime() { cachePerfStats.endGet(0, false); assertThat(statistics.getLong(getTimeId)).isEqualTo(CLOCK_TIME); }
/** * Characterization test: Note that the only way to increment {@code misses} is to invoke * {@code endGet}. */ @Test public void endGetIncrementsMisses() { cachePerfStats.endGet(0, true); assertThat(statistics.getInt(missesId)).isEqualTo(1); }
/** * Characterization test: Note that the only way to increment {@code gets} is to invoke * {@code endGet}. */ @Test public void endGetIncrementsGets() { cachePerfStats.endGet(0, false); assertThat(statistics.getInt(getsId)).isEqualTo(1); }
/** * @param start the timestamp taken when the operation started */ @Override public void endGet(long start, boolean miss) { if (enableClockStats) { this.stats.incLong(getTimeId, getStatTime() - start); } this.stats.incInt(getsId, 1); if (miss) { this.stats.incInt(missesId, 1); } this.cachePerfStats.endGet(start, miss); }
/** * Characterization test: {@code misses} currently wraps to negative from max integer value. */ @Test public void missesWrapsFromMaxIntegerToNegativeValue() { statistics.incInt(missesId, Integer.MAX_VALUE); cachePerfStats.endGet(0, true); assertThat(cachePerfStats.getMisses()).isNegative(); }
/** * Characterization test: {@code gets} currently wraps to negative from max integer value. */ @Test public void getsWrapsFromMaxIntegerToNegativeValue() { statistics.incInt(getsId, Integer.MAX_VALUE); cachePerfStats.endGet(0, false); assertThat(cachePerfStats.getGets()).isNegative(); }
/** * override the one in LocalRegion since we don't need to do getDeserialized. */ @Override public Object get(Object key, Object aCallbackArgument, boolean generateCallbacks, boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent, boolean returnTombstones) throws TimeoutException, CacheLoaderException { validateKey(key); checkReadiness(); checkForNoAccess(); discoverJTA(); CachePerfStats stats = getCachePerfStats(); long start = stats.startGet(); boolean miss = true; try { // if scope is local and there is no loader, then // don't go further to try and get value Object value = getDataView().findObject(getKeyInfo(key, aCallbackArgument), this, true/* isCreate */, generateCallbacks, null /* no local value */, disableCopyOnRead, preferCD, requestingClient, clientEvent, returnTombstones); if (value != null && !Token.isInvalid(value)) { miss = false; } return value; } finally { stats.endGet(start, miss); } }
stats.endGet(start, miss);
stats.endGet(start, isMiss);