|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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()
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. |
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 workspacesMethod Detail |
---|
public void setSleepBetweenNodes(long millis)
DataStoreGarbageCollector
setSleepBetweenNodes
in interface DataStoreGarbageCollector
millis
- the number of milliseconds to sleeppublic long getSleepBetweenNodes()
DataStoreGarbageCollector
getSleepBetweenNodes
in interface DataStoreGarbageCollector
public void setTestDelay(int testDelay)
testDelay
- the delay in millisecondspublic void setScanEventListener(ScanEventListener callback)
public void setMarkEventListener(MarkEventListener callback)
DataStoreGarbageCollector
setMarkEventListener
in interface DataStoreGarbageCollector
callback
- if set, this is called while scanningpublic void scan() throws RepositoryException
RepositoryException
public void mark() throws RepositoryException
DataStoreGarbageCollector
mark
in interface DataStoreGarbageCollector
RepositoryException
public void setPersistenceManagerScan(boolean allow)
DataStoreGarbageCollector
setPersistenceManagerScan
in interface DataStoreGarbageCollector
allow
- true if using the IterablePersistenceManager interface is allowedpublic boolean isPersistenceManagerScan()
DataStoreGarbageCollector
isPersistenceManagerScan
in interface DataStoreGarbageCollector
public boolean getPersistenceManagerScan()
public void stopScan() throws RepositoryException
RepositoryException
public int deleteUnused() throws RepositoryException
RepositoryException
public int sweep() throws RepositoryException
DataStoreGarbageCollector
sweep
in interface DataStoreGarbageCollector
RepositoryException
public DataStore getDataStore()
public void close()
DataStoreGarbageCollector
close
in interface DataStoreGarbageCollector
protected void finalize() throws Throwable
finalize
in class Object
Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |