Class ExecutionEnvironmentHeapManager

  • All Implemented Interfaces:
    Runnable

    public class ExecutionEnvironmentHeapManager
    extends HeapManager
    This class is responsible to manage objects in EE memory and update or store them in disk.
    • Field Detail

      • retainedObjects

        protected final Map<ObjectID,​DataClayObject> retainedObjects
        It is very important to be a sorted list, so first elements to arrive are cleaned before, in any deserialization from DB or parameter, objects deserialized first are referrers to objects deserialized later. Second ones cannot be GC if first ones are not cleaned. During GC,we should know that somehow. It's a hint but improves GC a lot. List must be thread-safe!! NOTE: Java concurrent hash map is more efficient than list. However, no insertion order is mantained. ConcurrentHashMap gain in performance is more than being unable to clean some objecs since it is in Critical Path (creation of objects).
    • Constructor Detail

      • ExecutionEnvironmentHeapManager

        public ExecutionEnvironmentHeapManager​(DataServiceRuntime theruntime)
        Contructor.
        Parameters:
        theruntime - The DataServiceRuntime.
    • Method Detail

      • getObjectIDsRetained

        public final Set<ObjectID> getObjectIDsRetained()
        Get object ids retained
        Returns:
        object ids retained
      • addToHeap

        public void addToHeap​(DataClayObject dcObject)
        Description copied from class: HeapManager
        Add object into Heap. This function can be different in EE or client. Therefore, it is abstract.
        Specified by:
        addToHeap in class HeapManager
        Parameters:
        dcObject - the object to add
      • retainInHeap

        public void retainInHeap​(DataClayObject object)
        Add a new Hard reference to the object provided. All code in stubs/exec classes using objects in dataClayheap are using weak references. In order to avoid objects to be GC without a flush in DB, HeapManager has hard-references to them and is the only one able to release them. This function creates the hard-reference.
        Parameters:
        object - Object to add
      • releaseFromHeap

        public final void releaseFromHeap​(ObjectID objectID)
        Release hard reference to object with ID provided. Without hard reference, the object can be Garbage collected by Java GC.
        Parameters:
        objectID - ID of the object
      • flushAll

        public void flushAll()
        Update all objects in memory (or store them if new). Function called at shutdown.
        Specified by:
        flushAll in class HeapManager