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.
|
int |
getConcurrentThreadSize() |
DataStore |
getDataStore()
Get the data store if one is used.
|
long |
getMinSplitSize() |
long |
getSleepBetweenNodes()
Get the delay between scanning items.
|
boolean |
isPersistenceManagerScan()
Check if using the IterablePersistenceManager interface is allowed.
|
void |
mark()
Scan the repository.
|
void |
setConcurrentThreadSize(int concurrentThreadSize) |
void |
setMarkEventListener(MarkEventListener callback)
Set the event listener.
|
void |
setMinSplitSize(long minSplitSize) |
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)
DataStoreGarbageCollector
setSleepBetweenNodes
in interface DataStoreGarbageCollector
millis
- the number of milliseconds to sleeppublic long getSleepBetweenNodes()
DataStoreGarbageCollector
getSleepBetweenNodes
in interface DataStoreGarbageCollector
public long getMinSplitSize()
public void setMinSplitSize(long minSplitSize)
public int getConcurrentThreadSize()
public void setConcurrentThreadSize(int concurrentThreadSize)
public void setTestDelay(int testDelay)
testDelay
- the delay in millisecondspublic void setMarkEventListener(MarkEventListener callback)
DataStoreGarbageCollector
setMarkEventListener
in interface DataStoreGarbageCollector
callback
- if set, this is called while scanningpublic 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 void stopScan() 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
Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.