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(DataStore dataStore,
IterablePersistenceManager[] list,
Session[] sessionList)
Create a new garbage collector.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Cleanup resources used internally by this instance.
|
int |
deleteUnused()
Deprecated.
use sweep().
|
protected void |
finalize()
Auto-close in case the application didn't call it explicitly.
|
DataStore |
getDataStore()
Get the data store if one is used.
|
boolean |
getPersistenceManagerScan()
Deprecated.
use isPersistenceManagerScan().
|
long |
getSleepBetweenNodes()
Get the delay between scanning items.
|
boolean |
isPersistenceManagerScan()
Check if using the IterablePersistenceManager interface is allowed.
|
void |
mark()
Scan the repository.
|
void |
scan()
Deprecated.
use mark().
|
void |
setMarkEventListener(MarkEventListener callback)
Set the event listener.
|
void |
setPersistenceManagerScan(boolean allow)
Enable or disable using the IterablePersistenceManager interface
to scan the items.
|
void |
setScanEventListener(ScanEventListener callback)
Deprecated.
use setMarkEventListener().
|
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()
Stop the observation listener if any are installed.
|
int |
sweep()
Delete all unused items in the data store.
|
public GarbageCollector(DataStore dataStore, IterablePersistenceManager[] list, Session[] sessionList)
dataStore - 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 setScanEventListener(ScanEventListener callback)
public void setMarkEventListener(MarkEventListener callback)
DataStoreGarbageCollectorsetMarkEventListener in interface DataStoreGarbageCollectorcallback - if set, this is called while scanningpublic void scan()
throws RepositoryException
RepositoryExceptionpublic void mark()
throws RepositoryException
DataStoreGarbageCollectormark in interface DataStoreGarbageCollectorRepositoryExceptionpublic void setPersistenceManagerScan(boolean allow)
DataStoreGarbageCollectorsetPersistenceManagerScan in interface DataStoreGarbageCollectorallow - true if using the IterablePersistenceManager interface is allowedpublic boolean isPersistenceManagerScan()
DataStoreGarbageCollectorisPersistenceManagerScan in interface DataStoreGarbageCollectorpublic boolean getPersistenceManagerScan()
public void stopScan()
throws RepositoryException
RepositoryExceptionpublic int deleteUnused()
throws RepositoryException
RepositoryExceptionpublic int sweep()
throws RepositoryException
DataStoreGarbageCollectorsweep in interface DataStoreGarbageCollectorRepositoryExceptionpublic DataStore getDataStore()
public void close()
DataStoreGarbageCollectorclose in interface DataStoreGarbageCollectorCopyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.