Class StorageLocation.ReservationHold<TEntry extends CacheEntry>

java.lang.Object
org.apache.druid.segment.loading.StorageLocation.ReservationHold<TEntry>
All Implemented Interfaces:
Closeable, AutoCloseable
Enclosing class:
StorageLocation

public static class StorageLocation.ReservationHold<TEntry extends CacheEntry> extends Object implements Closeable
A Closeable CacheEntry wrapper representing both the entry and a 'hold' that is placed on it to prevent the entry from being dropped by StorageLocation.reclaim(long) at least until the wrapper is closed.

In practice, if the entry is StorageLocation.weakCacheEntries the entry contained in this object was placed under a hold with StorageLocation.WeakCacheEntry.hold(), and close() with then call StorageLocation.WeakCacheEntry.release() to finish the hold. If the entry is instead StorageLocation.staticCacheEntries, a hold is not necessary since these entries will not be removed automatically during StorageLocation.reclaim(long), and instead are only ever being dropped if StorageLocation.release(CacheEntry) is explicitly called. Close is a no-op for these entries.

Callers MUST be sure to close this object when finished to release the hold

  • Constructor Details

    • ReservationHold

      public ReservationHold(TEntry entry, Runnable releaseHold)
  • Method Details