Class GarbageCollector

  • All Implemented Interfaces:
    DataStoreGarbageCollector

    public class GarbageCollector
    extends Object
    implements DataStoreGarbageCollector
    Garbage collector for DataStore. This implementation iterates through all nodes and reads the binary properties. To detect nodes that are moved while the scan runs, event listeners are started. Like the well known garbage collection in Java, the items that are still in use are marked. Currently this is achieved by updating the modified date of the entries. Newly added entries are detected because the modified date is changed when they are added.

    Example code to run the data store garbage collection:

     JackrabbitRepositoryFactory jf = (JackrabbitRepositoryFactory) factory;
     RepositoryManager m = jf.getRepositoryManager((JackrabbitRepository) repository);
     GarbageCollector gc = m.createDataStoreGarbageCollector();
     try {
         gc.mark();
         gc.sweep();
     } finally {
         gc.close();
     }