Class FullIdentityMap

    • Field Detail

      • cacheKeys

        protected java.util.Map<java.lang.Object,​CacheKey> cacheKeys
        Map of CacheKeys stored using their key.
    • Constructor Detail

      • FullIdentityMap

        public FullIdentityMap()
        Used to allow subclasses to build different map type.
    • Method Detail

      • getCacheKey

        public CacheKey getCacheKey​(java.lang.Object searchKey,
                                    boolean forMerge)
        Return the cache key matching the primary key of the searchKey. If no object for the key exists, return null.
        Specified by:
        getCacheKey in interface IdentityMap
        Specified by:
        getCacheKey in class AbstractIdentityMap
      • putCacheKeyIfAbsent

        protected CacheKey putCacheKeyIfAbsent​(CacheKey searchKey)
        Return the CacheKey (with object) matching the searchKey. If the CacheKey is missing then put the searchKey in the map. The searchKey should have already been locked.
        Specified by:
        putCacheKeyIfAbsent in class AbstractIdentityMap
      • getCacheKeys

        public java.util.Map<java.lang.Object,​CacheKey> getCacheKeys()
        Return the cache keys.
      • getSize

        public int getSize()
        Return the number of CacheKeys in the IdentityMap. This may contain weak referenced objects that have been garbage collected.
        Specified by:
        getSize in interface IdentityMap
        Specified by:
        getSize in class AbstractIdentityMap
      • getSize

        public int getSize​(java.lang.Class myClass,
                           boolean recurse)
        Return the number of actual objects of type myClass in the IdentityMap. Recurse = true will include subclasses of myClass in the count.
        Specified by:
        getSize in interface IdentityMap
        Specified by:
        getSize in class AbstractIdentityMap
      • keys

        public java.util.Enumeration<CacheKey> keys​(boolean checkReadLocks)
        Allow for the CacheKey elements to be iterated. CacheKey Collection is reused so this iteration may not be thread safe.
        Parameters:
        checkReadLocks - value of true if read lock on the CacheKey instances should be checked or false otherwise
        Returns:
        Enumeration of CacheKey instances.
      • cloneKeys

        public java.util.Enumeration<CacheKey> cloneKeys()
        Allow for the CacheKey elements to be iterated. Clone of CacheKey Collection is returned so this iteration should be thread safe.
        Returns:
        Enumeration with clone of the CacheKey Collection
      • lazyRelationshipLoaded

        public void lazyRelationshipLoaded​(java.lang.Object object,
                                           ValueHolderInterface valueHolder,
                                           ForeignReferenceMapping mapping)
        Notify the cache that a lazy relationship has been triggered in the object and the cache may need to be updated
      • put

        public CacheKey put​(java.lang.Object primaryKey,
                            java.lang.Object object,
                            java.lang.Object writeLockValue,
                            long readTime)
        Store the object in the cache at its primary key. This is used by InsertObjectQuery, typically into the UnitOfWork identity map. Merge and reads do not use put, but acquireLock. Also an advanced (very) user API.
        Specified by:
        put in interface IdentityMap
        Specified by:
        put in class AbstractIdentityMap
        Parameters:
        primaryKey - is the primary key for the object.
        object - is the domain object to cache.
        writeLockValue - is the current write lock value of object, if null the version is ignored.
      • remove

        public java.lang.Object remove​(CacheKey cacheKey)
        Removes the CacheKey from the map.
        Specified by:
        remove in interface IdentityMap
        Specified by:
        remove in class AbstractIdentityMap
        Returns:
        the object held within the CacheKey or null if no object cached for given cacheKey.
      • resetCacheKey

        public void resetCacheKey​(CacheKey key,
                                  java.lang.Object object,
                                  java.lang.Object writeLockValue,
                                  long readTime)
        Reset the cache key with new data.
      • setCacheKeys

        protected void setCacheKeys​(java.util.Map<java.lang.Object,​CacheKey> cacheKeys)