Codota Logo
RangeCache.getSize
Code IndexAdd Codota to your IDE (free)

How to use
getSize
method
in
org.apache.bookkeeper.mledger.util.RangeCache

Best Java code snippets using org.apache.bookkeeper.mledger.util.RangeCache.getSize (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: apache/pulsar

@Override
public long getSize() {
  return entries.getSize();
}
origin: apache/pulsar

@Override
public Pair<Integer, Long> evictEntries(long sizeToFree) {
  checkArgument(sizeToFree > 0);
  Pair<Integer, Long> evicted = entries.evictLeastAccessedEntries(sizeToFree);
  int evictedEntries = evicted.getLeft();
  long evictedSize = evicted.getRight();
  if (log.isDebugEnabled()) {
    log.debug(
        "[{}] Doing cache eviction of at least {} Mb -- Deleted {} entries - Total size deleted: {} Mb "
            + " -- Current Size: {} Mb",
        ml.getName(), sizeToFree / MB, evictedEntries, evictedSize / MB, entries.getSize() / MB);
  }
  manager.entriesRemoved(evictedSize);
  return evicted;
}
origin: apache/pulsar

assertEquals(cache.getSize(), 100);
Pair<Integer, Long> res = cache.evictLeastAccessedEntries(1);
assertEquals((int) res.getLeft(), 1);
assertEquals((long) res.getRight(), 1);
assertEquals(cache.getSize(), 99);
assertEquals(cache.getSize(), 89);
assertEquals(cache.getSize(), 0);
assertEquals(cache.getSize(), 100);
assertEquals(cache.getSize(), 90);
origin: apache/pulsar

@Test
void customWeighter() {
  RangeCache<Integer, RefString> cache = new RangeCache<>(value -> value.s.length());
  cache.put(0, new RefString("zero"));
  cache.put(1, new RefString("one"));
  assertEquals(cache.getSize(), 7);
  assertEquals(cache.getNumberOfEntries(), 2);
}
origin: apache/pulsar

@Test
void doubleInsert() {
  RangeCache<Integer, RefString> cache = new RangeCache<>();
  RefString s0 = new RefString("zero");
  assertEquals(s0.refCnt(), 1);
  assertEquals(cache.put(0, s0), true);
  assertEquals(s0.refCnt(), 1);
  cache.put(1, new RefString("one"));
  assertEquals(cache.getSize(), 2);
  assertEquals(cache.getNumberOfEntries(), 2);
  RefString s = cache.get(1);
  assertEquals(s.s, "one");
  assertEquals(s.refCnt(), 2);
  RefString s1 = new RefString("uno");
  assertEquals(s1.refCnt(), 1);
  assertEquals(cache.put(1, s1), false);
  assertEquals(s1.refCnt(), 1);
  s1.release();
  // Should not have been overridden in cache
  assertEquals(cache.getSize(), 2);
  assertEquals(cache.getNumberOfEntries(), 2);
  assertEquals(cache.get(1).s, "one");
}
origin: apache/pulsar

cache.put(1, new RefString("1"));
assertEquals(cache.getSize(), 2);
assertEquals(cache.getNumberOfEntries(), 2);
cache.put(11, new RefString("11"));
assertEquals(cache.getSize(), 5);
assertEquals(cache.getNumberOfEntries(), 5);
assertEquals(cache.getSize(), 3);
assertEquals(cache.getNumberOfEntries(), 3);
assertEquals(cache.getSize(), 3);
assertEquals(cache.getNumberOfEntries(), 3);
assertEquals(cache.getSize(), 0);
assertEquals(cache.getNumberOfEntries(), 0);
assertEquals(cache.getSize(), 0);
assertEquals(cache.getNumberOfEntries(), 0);
origin: apache/pulsar

assertEquals(cache.getSize(), 8);
assertEquals(cache.get(0), null);
assertEquals(cache.get(1), null);
assertEquals(cache.getSize(), 0);
assertEquals(cache.get(0), null);
assertEquals(cache.get(1), null);
origin: apache/pulsar

@Test
void getRange() {
  RangeCache<Integer, RefString> cache = new RangeCache<>();
  cache.put(0, new RefString("0"));
  cache.put(1, new RefString("1"));
  cache.put(3, new RefString("3"));
  cache.put(5, new RefString("5"));
  assertEquals(cache.getRange(1, 8),
      Lists.newArrayList(new RefString("1"), new RefString("3"), new RefString("5")));
  cache.put(8, new RefString("8"));
  assertEquals(cache.getRange(1, 8),
      Lists.newArrayList(new RefString("1"), new RefString("3"), new RefString("5"), new RefString("8")));
  cache.clear();
  assertEquals(cache.getSize(), 0);
  assertEquals(cache.getNumberOfEntries(), 0);
}
origin: org.apache.pulsar/managed-ledger-original

@Override
public long getSize() {
  return entries.getSize();
}
origin: com.yahoo.pulsar/managed-ledger

@Override
public long getSize() {
  return entries.getSize();
}
origin: org.apache.pulsar/managed-ledger-original

@Override
public Pair<Integer, Long> evictEntries(long sizeToFree) {
  checkArgument(sizeToFree > 0);
  Pair<Integer, Long> evicted = entries.evictLeastAccessedEntries(sizeToFree);
  int evictedEntries = evicted.getLeft();
  long evictedSize = evicted.getRight();
  if (log.isDebugEnabled()) {
    log.debug(
        "[{}] Doing cache eviction of at least {} Mb -- Deleted {} entries - Total size deleted: {} Mb "
            + " -- Current Size: {} Mb",
        ml.getName(), sizeToFree / MB, evictedEntries, evictedSize / MB, entries.getSize() / MB);
  }
  manager.entriesRemoved(evictedSize);
  return evicted;
}
origin: com.yahoo.pulsar/managed-ledger

@Override
public Pair<Integer, Long> evictEntries(long sizeToFree) {
  checkArgument(sizeToFree > 0);
  Pair<Integer, Long> evicted = entries.evictLeastAccessedEntries(sizeToFree);
  int evictedEntries = evicted.first;
  long evictedSize = evicted.second;
  if (log.isDebugEnabled()) {
    log.debug(
        "[{}] Doing cache eviction of at least {} Mb -- Deleted {} entries - Total size deleted: {} Mb "
            + " -- Current Size: {} Mb",
        ml.getName(), sizeToFree / MB, evictedEntries, evictedSize / MB, entries.getSize() / MB);
  }
  manager.entriesRemoved(evictedSize);
  return evicted;
}
org.apache.bookkeeper.mledger.utilRangeCachegetSize

Popular methods of RangeCache

  • <init>
    Construct a new RangeLruCache.
  • clear
    Remove all the entries from the cache.
  • evictLeastAccessedEntries
  • get
  • getRange
  • put
    Insert.
  • removeRange
  • getNumberOfEntries
    Just for testing. Getting the number of entries is very expensive on the conncurrent map

Popular in Java

  • Finding current android device location
  • getSystemService (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • ResourceBundle (java.util)
    Resource bundles contain locale-specific objects. When your program needs a locale-specific resource
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now