Class HeapManager

    • Field Detail

      • logger

        protected static final org.apache.logging.log4j.Logger logger
      • DEBUG_ENABLED

        protected static final boolean DEBUG_ENABLED
        Indicates if debug is enabled.
      • runtime

        protected final DataClayRuntime runtime
        Runtime being monitorized.
    • Constructor Detail

      • HeapManager

        public HeapManager​(DataClayRuntime theruntime)
        Constructor.
        Parameters:
        theruntime - Runtime to manage.
    • Method Detail

      • cleanReferencesAndLockers

        public void cleanReferencesAndLockers()
        Clean references in Heap pointing to null (weak references) and Lockers not being used.
      • getObject

        public DataClayObject getObject​(ObjectID objectID)
        Get object from Heap
        Parameters:
        objectID - ID of object
        Returns:
        DataClayObject or NULL if not found.
      • addToHeapMap

        protected void addToHeapMap​(DataClayObject dcObject)
        Create a weak reference of the object provided and add it into the heap.
        Parameters:
        dcObject - Object to add.
      • addToHeap

        public abstract void addToHeap​(DataClayObject dcObject)
        Add object into Heap. This function can be different in EE or client. Therefore, it is abstract.
        Parameters:
        dcObject - the object to add
      • removeFromHeap

        public final void removeFromHeap​(ObjectID objectID)
        Remove reference from Heap. Even if we remove it from the heap, the object won't be Garbage collected by JavaGC till HeapManager flushes the object and releases it.
        Parameters:
        objectID - ID of the object
      • existsObject

        public final boolean existsObject​(ObjectID objectID)
        Check if there is an object with ID provided.
        Parameters:
        objectID - ID of the object.
        Returns:
        TRUE if exists in memory. FALSE otherwise.
      • heapSize

        public final int heapSize()
        Get number of objects in memory.
        Returns:
        Number of objects in memory.
      • numLoadedObjs

        public final int numLoadedObjs()
        Get number of loaded objects in memory.
        Returns:
        Number of loaded objects in memory.
      • flushAll

        public abstract void flushAll()
        Flush all objects in Heap.
      • updateObjectID

        public void updateObjectID​(ObjectID oldObjectID,
                                   ObjectID newObjectID)
        Update an objectID.
        Parameters:
        oldObjectID - ID of the object to be updated.
        newObjectID - new ID of the object.