Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.storage.sql
Class DefaultBinaryManager.DefaultBinaryGarbageCollector

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.DefaultBinaryManager.DefaultBinaryGarbageCollector
All Implemented Interfaces:
BinaryGarbageCollector
Enclosing class:
DefaultBinaryManager

public static class DefaultBinaryManager.DefaultBinaryGarbageCollector
extends Object
implements BinaryGarbageCollector


Field Summary
static int TIME_RESOLUTION
          Windows FAT filesystems have a time resolution of 2s.
 
Constructor Summary
DefaultBinaryManager.DefaultBinaryGarbageCollector(DefaultBinaryManager binaryManager)
           
 
Method Summary
 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).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIME_RESOLUTION

public static int TIME_RESOLUTION
Windows FAT filesystems have a time resolution of 2s. Other common filesystems have 1s.

Constructor Detail

DefaultBinaryManager.DefaultBinaryGarbageCollector

public DefaultBinaryManager.DefaultBinaryGarbageCollector(DefaultBinaryManager binaryManager)
Method Detail

getId

public String getId()
Description copied from interface: BinaryGarbageCollector
Gets a unique identifier for this garbage collector. Two garbage collectors that would impact the same files must have the same identifier.

Specified by:
getId in interface BinaryGarbageCollector
Returns:
a unique identifier

getStatus

public BinaryManagerStatus 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 interface BinaryGarbageCollector
Returns:
the status

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 interface BinaryGarbageCollector
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 interface BinaryGarbageCollector

mark

public void mark(String digest)
Description copied from interface: BinaryGarbageCollector
Marks a binary as being in use.

Specified by:
mark in interface BinaryGarbageCollector
Parameters:
digest - the binary's digest

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 interface BinaryGarbageCollector
Parameters:
delete - true if actual deletion must be performed, false if the binaries to delete should simply be counted in the status

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.