|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.data.GarbageCollector
public class GarbageCollector
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();
}
| Field Summary | |
|---|---|
protected int |
testDelay
|
| Constructor Summary | |
|---|---|
GarbageCollector(DataStore dataStore,
IterablePersistenceManager[] list,
SessionImpl[] sessionList)
Create a new garbage collector. |
|
| Method Summary | |
|---|---|
void |
close()
|
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()
|
boolean |
isPersistenceManagerScan()
|
void |
mark()
|
void |
scan()
Deprecated. use mark(). |
void |
setMarkEventListener(org.apache.jackrabbit.api.management.MarkEventListener callback)
|
void |
setPersistenceManagerScan(boolean allow)
|
void |
setScanEventListener(ScanEventListener callback)
Deprecated. use setMarkEventListener(). |
void |
setSleepBetweenNodes(long millis)
|
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()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int testDelay
| Constructor Detail |
|---|
public GarbageCollector(DataStore dataStore,
IterablePersistenceManager[] list,
SessionImpl[] sessionList)
dataStore - the data store to be garbage-collectedlist - the persistence managerssessionList - the sessions to access the workspaces| Method Detail |
|---|
public void setSleepBetweenNodes(long millis)
setSleepBetweenNodes in interface org.apache.jackrabbit.api.management.DataStoreGarbageCollectorpublic long getSleepBetweenNodes()
getSleepBetweenNodes in interface org.apache.jackrabbit.api.management.DataStoreGarbageCollectorpublic void setTestDelay(int testDelay)
testDelay - the delay in millisecondspublic void setScanEventListener(ScanEventListener callback)
public void setMarkEventListener(org.apache.jackrabbit.api.management.MarkEventListener callback)
setMarkEventListener in interface org.apache.jackrabbit.api.management.DataStoreGarbageCollector
public void scan()
throws RepositoryException
RepositoryException
public void mark()
throws RepositoryException
mark in interface org.apache.jackrabbit.api.management.DataStoreGarbageCollectorRepositoryExceptionpublic void setPersistenceManagerScan(boolean allow)
setPersistenceManagerScan in interface org.apache.jackrabbit.api.management.DataStoreGarbageCollectorpublic boolean isPersistenceManagerScan()
isPersistenceManagerScan in interface org.apache.jackrabbit.api.management.DataStoreGarbageCollectorpublic boolean getPersistenceManagerScan()
public void stopScan()
throws RepositoryException
RepositoryException
public int deleteUnused()
throws RepositoryException
RepositoryException
public int sweep()
throws RepositoryException
sweep in interface org.apache.jackrabbit.api.management.DataStoreGarbageCollectorRepositoryExceptionpublic DataStore getDataStore()
public void close()
close in interface org.apache.jackrabbit.api.management.DataStoreGarbageCollector
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||