public class GarbageCollector extends Object implements DataStoreGarbageCollector
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();
}
| Modifier and Type | Field and Description |
|---|---|
protected int |
testDelay |
| Constructor and Description |
|---|
GarbageCollector(RepositoryContext context,
DataStore dataStore,
IterablePersistenceManager[] list,
SessionImpl[] sessionList)
Create a new garbage collector.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Cleanup resources used internally by this instance.
|
protected void |
finalize()
Auto-close in case the application didn't call it explicitly.
|
DataStore |
getDataStore()
Get the data store if one is used.
|
long |
getSleepBetweenNodes()
Get the delay between scanning items.
|
boolean |
isPersistenceManagerScan()
Check if using the IterablePersistenceManager interface is allowed.
|
void |
mark()
Scan the repository.
|
void |
setMarkEventListener(MarkEventListener callback)
Set the event listener.
|
void |
setPersistenceManagerScan(boolean allow)
Enable or disable using the IterablePersistenceManager interface
to scan the items.
|
void |
setSleepBetweenNodes(long millis)
Set the delay between scanning items.
|
void |
setTestDelay(int testDelay)
When testing the garbage collection, a delay is used instead of simulating concurrent access.
|
void |
stopScan()
Reset modifiedDateOnAccess to 0 and stop the observation
listener if any are installed.
|
int |
sweep()
Delete all unused items in the data store.
|
public GarbageCollector(RepositoryContext context, DataStore dataStore, IterablePersistenceManager[] list, SessionImpl[] sessionList)
context - repository contextdataStore - the data store to be garbage-collectedlist - the persistence managerssessionList - the sessions to access the workspacespublic void setSleepBetweenNodes(long millis)
DataStoreGarbageCollectorsetSleepBetweenNodes in interface DataStoreGarbageCollectormillis - the number of milliseconds to sleeppublic long getSleepBetweenNodes()
DataStoreGarbageCollectorgetSleepBetweenNodes in interface DataStoreGarbageCollectorpublic void setTestDelay(int testDelay)
testDelay - the delay in millisecondspublic void setMarkEventListener(MarkEventListener callback)
DataStoreGarbageCollectorsetMarkEventListener in interface DataStoreGarbageCollectorcallback - if set, this is called while scanningpublic void mark()
throws javax.jcr.RepositoryException
DataStoreGarbageCollectormark in interface DataStoreGarbageCollectorjavax.jcr.RepositoryExceptionpublic void setPersistenceManagerScan(boolean allow)
DataStoreGarbageCollectorsetPersistenceManagerScan in interface DataStoreGarbageCollectorallow - true if using the IterablePersistenceManager interface is allowedpublic boolean isPersistenceManagerScan()
DataStoreGarbageCollectorisPersistenceManagerScan in interface DataStoreGarbageCollectorpublic void stopScan()
throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic int sweep()
throws javax.jcr.RepositoryException
DataStoreGarbageCollectorsweep in interface DataStoreGarbageCollectorjavax.jcr.RepositoryExceptionpublic DataStore getDataStore()
public void close()
DataStoreGarbageCollectorclose in interface DataStoreGarbageCollectorCopyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.