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
Basic implementation for a garbage collector recording marked or to-delete blobs in memory.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Computes keys candidate for deletion.Gets the status of the binaries to GC and of those that won't be.boolean
Checks if a GC is in progress.void
Marks a binary as being in use.void
removeBlobs
(Set<String> keys) void
removeUnmarkedBlobsAndUpdateStatus
(boolean delete) void
start()
Starts the garbage collection process.void
stop
(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 Details
-
startTime
protected volatile long startTime -
status
-
marked
-
toDelete
-
-
Constructor Details
-
AbstractBlobGarbageCollector
public AbstractBlobGarbageCollector()
-
-
Method Details
-
isInProgress
public boolean isInProgress()Description copied from interface:BinaryGarbageCollector
Checks if a GC is in progress.A GC is in progress is
#start
has 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:
isInProgress
in interfaceBinaryGarbageCollector
- Returns:
true
if a GC is in progress
-
start
public void start()Description copied from interface:BinaryGarbageCollector
Starts the garbage collection process.After this, all active binaries must be fed to the
BinaryGarbageCollector.mark(java.lang.String)
method.- Specified by:
start
in 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:BinaryGarbageCollector
Stops the garbage collection process and deletes all binaries that have not been marked (sweep).- Specified by:
stop
in interfaceBinaryGarbageCollector
- Parameters:
delete
-true
if actual deletion must be performed,false
if the binaries to delete should simply be counted in the status
-
removeUnmarkedBlobsAndUpdateStatus
public void removeUnmarkedBlobsAndUpdateStatus(boolean delete) -
getUnmarkedBlobsAndUpdateStatus
-
removeBlobs
-
mark
Description copied from interface:BinaryGarbageCollector
Marks a binary as being in use.- Specified by:
mark
in interfaceBinaryGarbageCollector
- Parameters:
digest
- the binary's digest
-
getStatus
Description copied from interface:BinaryGarbageCollector
Gets the status of the binaries to GC and of those that won't be.Available after
BinaryGarbageCollector.stop(boolean)
.- Specified by:
getStatus
in interfaceBinaryGarbageCollector
- Returns:
- the status
-