Exemplo n.º 1
0
 protected void assertWriteSkew(Cache<?, ?> cache, String key, long expected) {
   final CacheUsageInterceptor topK = getTopKey(cache);
   eventuallyEquals(
       format("Wrong number of write skew for key '%s' and cache '%s'.", key, addressOf(cache)),
       expected,
       () -> topK.getTopWriteSkewFailedKeys().getOrDefault(key, 0L));
 }
Exemplo n.º 2
0
 private void assertTopKeyLockContented(Cache<?, ?> cache, String key, long expected) {
   final CacheUsageInterceptor topK = getTopKey(cache);
   eventuallyEquals(
       format("Wrong number of contented key for key '%s' and cache '%s'.", key, addressOf(cache)),
       expected,
       () -> topK.getTopContendedKeys().getOrDefault(key, 0L));
 }
Exemplo n.º 3
0
 protected void assertTopKeyAccesses(
     Cache<?, ?> cache, String key, long expected, boolean readAccesses) {
   final CacheUsageInterceptor topK = getTopKey(cache);
   final boolean isLocal = isOwner(cache, key);
   eventuallyEquals(
       format("Wrong number of accesses for key '%s' and cache '%s'.", key, addressOf(cache)),
       expected,
       () -> {
         if (readAccesses) {
           return (isLocal ? topK.getLocalTopGets() : topK.getRemoteTopGets())
               .getOrDefault(key, 0L);
         } else {
           return (isLocal ? topK.getLocalTopPuts() : topK.getRemoteTopPuts())
               .getOrDefault(key, 0L);
         }
       });
 }