Package es.bsc.dataclay.storagelocation
Class DataClayDiskGC
- java.lang.Object
-
- es.bsc.dataclay.storagelocation.DataClayDiskGC
-
public final class DataClayDiskGC extends Object
This class is responsible to collect objects in disk.
-
-
Field Summary
Fields Modifier and Type Field Description protected ScheduledExecutorService
threadPool
Pool for tasks.
-
Constructor Summary
Constructors Constructor Description DataClayDiskGC(StorageLocationService thestorageLocationService, DataServiceRuntime theruntime, ExecutionEnvironmentID theassociatedEE)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToQueueReferenceCounting(ExecutionEnvironmentID theEEID, ObjectID theobjectID, byte[] serializedObject, boolean theisGet, boolean dirty)
Add reference counting of an object ("counter of referenced objects FROM the object serialized provided") into queue so DiskGC can process it.int
getNumReferencesTo(ObjectID objectID)
Return number of references pointing to object.void
shutDown()
Finish all threads.void
updateRefs(Map<ObjectID,Integer> updateCounterRefs)
Update counters of references.
-
-
-
Field Detail
-
threadPool
protected final ScheduledExecutorService threadPool
Pool for tasks.
-
-
Constructor Detail
-
DataClayDiskGC
public DataClayDiskGC(StorageLocationService thestorageLocationService, DataServiceRuntime theruntime, ExecutionEnvironmentID theassociatedEE)
Constructor.- Parameters:
thestorageLocationService
- Storage location service.theruntime
- The runtime to use for communications and others.theassociatedEE
- Associated execution environment ID.
-
-
Method Detail
-
addToQueueReferenceCounting
public void addToQueueReferenceCounting(ExecutionEnvironmentID theEEID, ObjectID theobjectID, byte[] serializedObject, boolean theisGet, boolean dirty)
Add reference counting of an object ("counter of referenced objects FROM the object serialized provided") into queue so DiskGC can process it. Parameter contains all bytes of the object. We extract the bytes representing the reference counting in order to avoid 'retaining' bytes in memory (resource leak). This function is called during a get from DB, an update or a store. We add the bytes representing the reference counting without deserializing it in order to let thread continue work and wait for GC to deserialize and process it.- Parameters:
theEEID
- ID of the execution environment ID of the object.theobjectID
- ID of the objectserializedObject
- Serialized object.theisGet
- Indicates if reference counting arrived during a GET operation. If False, we understand it is a wRITE (update/store) operation.dirty
- dirty Indicates object has been modified. If false, it means that bytes only contains reference counting information. DESIGN NOTE: in order to be able to find out which references where removed in complex objects (arrays, collections) GlobalGc decreases all pointed references in a Get procedure and increase them again (except removed ones) during update. While in EE, objects have memory references so they cannot be removed neither.
-
updateRefs
public void updateRefs(Map<ObjectID,Integer> updateCounterRefs)
Update counters of references.- Parameters:
updateCounterRefs
- Update counter of references.
-
shutDown
public void shutDown()
Finish all threads.
-
getNumReferencesTo
public int getNumReferencesTo(ObjectID objectID)
Return number of references pointing to object.- Parameters:
objectID
- ID of object- Returns:
- Number of references pointing to object
-
-