Class WeakUnitOfWorkIdentityMap

All Implemented Interfaces:
Serializable, Cloneable, IdentityMap

public class WeakUnitOfWorkIdentityMap extends UnitOfWorkIdentityMap
See Also:
  • Field Details

    • referenceQueue

      protected ReferenceQueue referenceQueue
    • cleanupCount

      protected volatile int cleanupCount
      Keep track of a counter to amortize cleanup of dead cache keys
    • cleanupSize

      protected volatile int cleanupSize
      PERF: Keep track of a cleanup size to avoid cleanup bottleneck for large caches.
  • Constructor Details

  • Method Details

    • cleanupDeadCacheKeys

      protected void cleanupDeadCacheKeys()
      Search for any cache keys that have been garbage collected and remove them. This must be done because although the objects held by the cache keys will garbage collect, the keys themselves will not and must be cleaned up. This is a linear operation so is amortized through the cleanupCount to occur only once per cycle averaging to make the total time still constant.
    • createCacheKey

      public CacheKey createCacheKey(Object primaryKey, Object object, Object writeLockValue, long readTime)
      Description copied from class: AbstractIdentityMap
      Create the correct type of CacheKey for this map.
      Overrides:
      createCacheKey in class UnitOfWorkIdentityMap
    • putCacheKeyIfAbsent

      protected CacheKey putCacheKeyIfAbsent(CacheKey searchKey)
      Need to check for cleanup on put.
      Overrides:
      putCacheKeyIfAbsent in class UnitOfWorkIdentityMap
    • checkCleanup

      protected void checkCleanup()
      Check if garbage collected cache keys need to be cleaned up.