Class AbstractJournalRM.CollectorDaemon.CollectionCoordinator
- Enclosing class:
AbstractJournalRM.CollectorDaemon
The CollectionCoordinator is also responsible for finalizing a collection which in this context acts as a barrier to clients exposing the memory reclaimed during the evacuation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
actionable
(AbstractJournalRM.JournalFile jrnlFile) Inform the CollectionCoordinator of an item that could be actioned if the CollectorDaemon was to execute.protected double
Calculate current load factor for compaction (GC).Return a reserved file.protected void
evacuate
(AbstractJournalRM.JournalFile jrnlFile) Inform the CollectionCoordinator of aAbstractJournalRM.JournalFile
about to be evacuated.void
exhaustiveEvac
(int cBytes, boolean fWait) Request the CollectorDaemon to perform an exhaustive evacuation and block this thread until the collection is complete.protected void
Inform the CollectionCoordinator that a collection is complete and changes should be exposed.int
Determine the average number of milliseconds to evacuate a file.int
Return the number of files evacuated since the statistics were reset.int
Return the total number of exhaustive evacuations performed by the collector.long
Return the number of milliseconds it took to perform exhaustive evacuations by the collector.Return aAbstractJournalRM.JournalFile
based on the context of the calling thread or null if it is determined that an exhaustive evacuation will not reclaim sufficient memory.int
Determine the maximum number of milliseconds to evacuate a file.int
Return the reserved file id.protected long
Return the amount of time the collector should wait prior to the next collection.boolean
Return true if memory has been reclaimed by evacuating a journal file or discarding of a garbage file.protected boolean
Return whether this is an exhaustive evacuation.void
onReleased
(int cbReleased, int nFileId) Notify the CollectionCoordinator that aAbstractJournalRM.JournalFile
has released the provided amount of memory.void
onStart()
Inform the CollectionCoordinator that a collection is about to commence.protected void
AAbstractJournalRM.JournalFile
has been dereferenced thus memory has been reclaimed.protected void
release()
Release the reserved file(s) used thus far into the RM'sAbstractJournalRM.JournalFile
pool so that they are linked appropriately.void
Reset the collector statistics.protected boolean
Return whether an exhaustive evacuation should be executed.
-
Constructor Details
-
CollectionCoordinator
protected CollectionCoordinator()
-
-
Method Details
-
getFinalJournalFile
Return aAbstractJournalRM.JournalFile
based on the context of the calling thread or null if it is determined that an exhaustive evacuation will not reclaim sufficient memory. This method should only be invoked in a "depleted" state when:- the maximum number of files is used
- all those files are
non-appending
When called on the CollectorDaemon thread this method returns a normal JournalFile, with the only exception that it will be in excess to the maximum number of permitted journal files and used exclusively by the CollectorDaemon to perform evacuation in a depleted state.
- Returns:
- a JournalFile either triggering a full collection or a
file used exclusively by the CollectorDaemon.
null
may be returned if it is determined that an exhaustive evacuation will not reclaim sufficient memory
-
exhaustiveEvac
public void exhaustiveEvac(int cBytes, boolean fWait) Request the CollectorDaemon to perform an exhaustive evacuation and block this thread until the collection is complete.- Parameters:
cBytes
- the number of bytes required by this store requestfWait
- whether to block the calling thread until sufficient memory has been reclaimed
-
onReleased
public void onReleased(int cbReleased, int nFileId) Notify the CollectionCoordinator that aAbstractJournalRM.JournalFile
has released the provided amount of memory.- Parameters:
cbReleased
- the number of bytes releasednFileId
- the journal file id that was released from
-
getReservedFileId
public int getReservedFileId()Return the reserved file id.- Returns:
- the reserved file id
-
getEvacuatedFileCount
public int getEvacuatedFileCount()Return the number of files evacuated since the statistics were reset.- Returns:
- the number of files evacuated
-
getExhaustiveCompactionCount
public int getExhaustiveCompactionCount()Return the total number of exhaustive evacuations performed by the collector.- Returns:
- the total number of exhaustive evacuations performed by the collector
-
getExhaustiveCompactionTime
public long getExhaustiveCompactionTime()Return the number of milliseconds it took to perform exhaustive evacuations by the collector.- Returns:
- the total number of milliseconds spent in performing exhaustive evacuations
-
getAvgEvacuationMillis
public int getAvgEvacuationMillis()Determine the average number of milliseconds to evacuate a file.- Returns:
- the average number of milliseconds to perform evacuation
-
getMaxEvacuationMillis
public int getMaxEvacuationMillis()Determine the maximum number of milliseconds to evacuate a file.- Returns:
- the number of milliseconds of the longest evacuation
-
resetStatistics
public void resetStatistics()Reset the collector statistics. -
ensureReservedFile
Return a reserved file.This method is only invoked in a 'depleted' state in which no more journal files can be created thus the reserved slot in the JournalFile[] must be used. This slot is reserved exclusively for the CollectorDaemon.
- Returns:
- a usable file from the survivor pool
-
onStart
public void onStart()Inform the CollectionCoordinator that a collection is about to commence. -
finalizeCollection
protected void finalizeCollection()Inform the CollectionCoordinator that a collection is complete and changes should be exposed. -
getWaitTime
protected long getWaitTime()Return the amount of time the collector should wait prior to the next collection.- Returns:
- the amount of time prior to the next collection
-
actionable
Inform the CollectionCoordinator of an item that could be actioned if the CollectorDaemon was to execute. This may influence the interval before the next CollectorDaemon execution. -
evacuate
Inform the CollectionCoordinator of aAbstractJournalRM.JournalFile
about to be evacuated.- Parameters:
jrnlFile
- a journal file about to be evacuated
-
reclaimJournalFile
AAbstractJournalRM.JournalFile
has been dereferenced thus memory has been reclaimed.- Parameters:
jrnlFile
- the journal file that has transitioned
-
isExhaustiveEvacuation
protected boolean isExhaustiveEvacuation()Return whether this is an exhaustive evacuation.- Returns:
- whether this is an exhaustive evacuation
-
hasReclaimedMemory
public boolean hasReclaimedMemory()Return true if memory has been reclaimed by evacuating a journal file or discarding of a garbage file.- Returns:
- whether any files have been discarded during the collection
-
calculateCurrentLoadFactor
protected double calculateCurrentLoadFactor()Calculate current load factor for compaction (GC).- Returns:
- calculated load factor
-
release
protected void release()Release the reserved file(s) used thus far into the RM'sAbstractJournalRM.JournalFile
pool so that they are linked appropriately. Additionally expose the slots that were free'd allowing clients awoken to carry out store requests.Calls to release when in exhaustive evacuation mode must hold the lock
f_lockClientGC
prior to calling release. -
shouldExecuteFullGc
protected boolean shouldExecuteFullGc()Return whether an exhaustive evacuation should be executed.- Returns:
- whether an exhaustive evacuation should be executed
-