public static class LocalBinaryManager.DefaultBinaryGarbageCollector extends Object implements BinaryGarbageCollector
Modifier and Type | Field and Description |
---|---|
protected LocalBinaryManager |
binaryManager |
protected long |
startTime |
protected BinaryManagerStatus |
status |
static int |
TIME_RESOLUTION
Windows FAT filesystems have a time resolution of 2s.
|
Constructor and Description |
---|
DefaultBinaryGarbageCollector(LocalBinaryManager binaryManager) |
Modifier and Type | Method and Description |
---|---|
protected void |
deleteOld(File file,
long minTime,
int depth,
boolean delete) |
String |
getId()
Gets a unique identifier for this garbage collector.
|
BinaryManagerStatus |
getStatus()
Gets the status of the binaries to GC and of those that won't be.
|
boolean |
isInProgress()
Checks if a GC is in progress.
|
void |
mark(String digest)
Marks a binary as being in use.
|
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).
|
public static int TIME_RESOLUTION
protected final LocalBinaryManager binaryManager
protected volatile long startTime
protected BinaryManagerStatus status
public DefaultBinaryGarbageCollector(LocalBinaryManager binaryManager)
public String getId()
BinaryGarbageCollector
getId
in interface BinaryGarbageCollector
public BinaryManagerStatus getStatus()
BinaryGarbageCollector
Available after BinaryGarbageCollector.stop(boolean)
.
getStatus
in interface BinaryGarbageCollector
public boolean isInProgress()
BinaryGarbageCollector
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)
.
isInProgress
in interface BinaryGarbageCollector
true
if a GC is in progresspublic void start()
BinaryGarbageCollector
After this, all active binaries must be fed to the BinaryGarbageCollector.mark(java.lang.String)
method.
start
in interface BinaryGarbageCollector
public void mark(String digest)
BinaryGarbageCollector
mark
in interface BinaryGarbageCollector
digest
- the binary's digestpublic void stop(boolean delete)
BinaryGarbageCollector
stop
in interface BinaryGarbageCollector
delete
- true
if actual deletion must be performed, false
if the binaries to delete should
simply be counted in the statusCopyright © 2015 Nuxeo SA. All rights reserved.