Class LockFreePrefixTree.ObjectPoolingAllocator

java.lang.Object
org.graalvm.collections.LockFreePrefixTree.Allocator
org.graalvm.collections.LockFreePrefixTree.ObjectPoolingAllocator
Enclosing class:
LockFreePrefixTree

public static class LockFreePrefixTree.ObjectPoolingAllocator extends LockFreePrefixTree.Allocator
Allocator that internally maintains several pools of preallocated objects, and allocates objects from those pools. This allocator is guaranteed not to allocate any objects inside the invocations to its methods. To ensure that the internal pools have sufficiently many preallocated objects, this allocator has a housekeeping thread that periodically wakes up, allocates objects and inserts them into the pools. This allocator tracks the requests that failed since the last housekeeping session, and the housekeeping thread will strive to accomodate requests that have not been fulfilled since the last housekeeping session (i.e. it will preallocate those types of additional objects whose allocation request previously failed, and it will allocate at least as many objects as there were previous failed allocation requests). This implementation only allows allocating Node.LinearChildren and Node.HashChildren arrays whose length is a power of 2 (because LockFreePrefixTree only ever allocates arrays that are a power of 2). If the requested array length is not a power of 2, an exception is thrown.
Since:
23.0
  • Constructor Details

    • ObjectPoolingAllocator

      public ObjectPoolingAllocator()
      Since:
      23.0
    • ObjectPoolingAllocator

      public ObjectPoolingAllocator(int housekeepingPeriodMillis)
      Since:
      23.0
  • Method Details