Package org.nuxeo.ecm.core.blob
Class AbstractBlobGarbageCollector
- java.lang.Object
-
- org.nuxeo.ecm.core.blob.AbstractBlobGarbageCollector
-
- All Implemented Interfaces:
BinaryGarbageCollector
- Direct Known Subclasses:
AzureBlobStore.AzureBlobGarbageCollector,EmptyBlobStore.EmptyBlobGarbageCollector,GoogleStorageBlobStore.GoogleStorageBlobGarbageCollector,GridFSBlobStore.GridFSBlobGarbageCollector,InMemoryBlobStore.InMemoryBlobGarbageCollector,S3BlobStore.S3BlobGarbageCollector
public abstract class AbstractBlobGarbageCollector extends Object implements BinaryGarbageCollector
Basic implementation for a garbage collector recording marked or to-delete blobs in memory.
-
-
Constructor Summary
Constructors Constructor Description AbstractBlobGarbageCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomputeToDelete()Computes keys candidate for deletion.BinaryManagerStatusgetStatus()Gets the status of the binaries to GC and of those that won't be.Set<String>getUnmarkedBlobsAndUpdateStatus()booleanisInProgress()Checks if a GC is in progress.voidmark(String digest)Marks a binary as being in use.voidremoveBlobs(Set<String> keys)voidremoveUnmarkedBlobsAndUpdateStatus(boolean delete)voidstart()Starts the garbage collection process.voidstop(boolean delete)Stops the garbage collection process and deletes all binaries that have not been marked (sweep).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.blob.binary.BinaryGarbageCollector
getId
-
-
-
-
Field Detail
-
startTime
protected volatile long startTime
-
status
protected BinaryManagerStatus status
-
-
Method Detail
-
isInProgress
public boolean isInProgress()
Description copied from interface:BinaryGarbageCollectorChecks if a GC is in progress.A GC is in progress is
#starthas been called but not#stop.It's only useful to call this from a separate thread from the one that calls
BinaryGarbageCollector.mark(java.lang.String).- Specified by:
isInProgressin interfaceBinaryGarbageCollector- Returns:
trueif a GC is in progress
-
start
public void start()
Description copied from interface:BinaryGarbageCollectorStarts the garbage collection process.After this, all active binaries must be fed to the
BinaryGarbageCollector.mark(java.lang.String)method.- Specified by:
startin interfaceBinaryGarbageCollector
-
computeToDelete
public void computeToDelete()
Computes keys candidate for deletion.Overrides should not call super (this allows detecting old implementations).
- Since:
- 11.5
-
stop
public void stop(boolean delete)
Description copied from interface:BinaryGarbageCollectorStops the garbage collection process and deletes all binaries that have not been marked (sweep).- Specified by:
stopin interfaceBinaryGarbageCollector- Parameters:
delete-trueif actual deletion must be performed,falseif the binaries to delete should simply be counted in the status
-
removeUnmarkedBlobsAndUpdateStatus
public void removeUnmarkedBlobsAndUpdateStatus(boolean delete)
-
mark
public void mark(String digest)
Description copied from interface:BinaryGarbageCollectorMarks a binary as being in use.- Specified by:
markin interfaceBinaryGarbageCollector- Parameters:
digest- the binary's digest
-
getStatus
public BinaryManagerStatus getStatus()
Description copied from interface:BinaryGarbageCollectorGets the status of the binaries to GC and of those that won't be.Available after
BinaryGarbageCollector.stop(boolean).- Specified by:
getStatusin interfaceBinaryGarbageCollector- Returns:
- the status
-
-