|
||||||||||
| 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 is 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 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 = factory.getRepositoryManager((JackrabbitRepository) rep);
GarbageCollector gc = m.createDataStoreGarbageCollector();
try {
gc.mark();
gc.sweep();
} finally {
gc.close();
}
| Constructor Summary | |
|---|---|
GarbageCollector(RepositoryImpl rep,
SessionImpl session,
IterablePersistenceManager[] list,
Session[] 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(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 |
| Constructor Detail |
|---|
public GarbageCollector(RepositoryImpl rep,
SessionImpl session,
IterablePersistenceManager[] list,
Session[] sessionList)
rep - the repositorysession - the session that created this object (optional)list - the persistence managerssessionList - the sessions to access the workspaces| Method Detail |
|---|
public void setSleepBetweenNodes(long millis)
setSleepBetweenNodes in interface DataStoreGarbageCollectorpublic long getSleepBetweenNodes()
getSleepBetweenNodes in interface DataStoreGarbageCollectorpublic void setTestDelay(int testDelay)
testDelay - the delay in millisecondspublic void setScanEventListener(ScanEventListener callback)
public void setMarkEventListener(MarkEventListener callback)
setMarkEventListener in interface DataStoreGarbageCollector
public void scan()
throws RepositoryException
RepositoryException
public void mark()
throws RepositoryException
mark in interface DataStoreGarbageCollectorRepositoryExceptionpublic void setPersistenceManagerScan(boolean allow)
setPersistenceManagerScan in interface DataStoreGarbageCollectorpublic boolean isPersistenceManagerScan()
isPersistenceManagerScan in interface DataStoreGarbageCollectorpublic boolean getPersistenceManagerScan()
public void stopScan()
throws RepositoryException
RepositoryException
public int deleteUnused()
throws RepositoryException
RepositoryException
public int sweep()
throws RepositoryException
sweep in interface DataStoreGarbageCollectorRepositoryExceptionpublic DataStore getDataStore()
public void close()
close in interface 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 | |||||||||