Class DataStoreGarbageCollectorTask
- java.lang.Object
-
- org.ametys.workspaces.repository.maintenance.AbstractMaintenanceTask
-
- org.ametys.workspaces.repository.maintenance.DataStoreGarbageCollectorTask
-
- All Implemented Interfaces:
LogEnabled
,MarkEventListener
public class DataStoreGarbageCollectorTask extends AbstractMaintenanceTask implements MarkEventListener
DataStoreGarbageCollectorTask
-
-
Field Summary
Fields Modifier and Type Field Description private GarbageCollector
_garbageCollector
private IterablePersistenceManager[]
_pmList
protected RepositoryContext
_repositoryContext
The JackRabbit RepositoryImpl Contextprivate int
_scannedNodesCount
Internal counter for scanned node by the GCprotected Session
_session
The JCR Session bound to this task.private static int
SYSTEM_GC_CALLS
-
Fields inherited from class org.ametys.workspaces.repository.maintenance.AbstractMaintenanceTask
_logger, _progress, _repositoryConfig, _repositoryProvider
-
-
Constructor Summary
Constructors Constructor Description DataStoreGarbageCollectorTask()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_derbyCompressTable(DbDataStore ds)
Reclaiming unused space.private long
_reportDataStoreInfo(DataStore ds)
protected void
apply()
Apply the tasks (within the execute method()).void
beforeScanning(Node n)
protected void
close()
Close the tasksprivate static Object
findAndInvokeMethod(Object obj, String name, Object[] parameters)
protected PersistenceManager
getPM(String workspaceName)
Retrieves JackRabbit Persistence Manager for currently opened repository.protected void
initialize()
Initialize the tasks.protected void
setLogger()
Set the tasks logger.-
Methods inherited from class org.ametys.workspaces.repository.maintenance.AbstractMaintenanceTask
_getFormattedDuration, execute, getProgressInfo, isFinished, setLogger
-
-
-
-
Field Detail
-
SYSTEM_GC_CALLS
private static final int SYSTEM_GC_CALLS
- See Also:
- Constant Field Values
-
_repositoryContext
protected RepositoryContext _repositoryContext
The JackRabbit RepositoryImpl Context
-
_garbageCollector
private GarbageCollector _garbageCollector
-
_pmList
private IterablePersistenceManager[] _pmList
-
_scannedNodesCount
private int _scannedNodesCount
Internal counter for scanned node by the GC
-
-
Constructor Detail
-
DataStoreGarbageCollectorTask
public DataStoreGarbageCollectorTask()
-
-
Method Detail
-
initialize
protected void initialize() throws RepositoryException
Description copied from class:AbstractMaintenanceTask
Initialize the tasks. This method can also create theTaskProgress
object bounded to the task.- Overrides:
initialize
in classAbstractMaintenanceTask
- Throws:
RepositoryException
- If a repository exception
-
setLogger
protected void setLogger()
Description copied from class:AbstractMaintenanceTask
Set the tasks logger.- Specified by:
setLogger
in classAbstractMaintenanceTask
-
apply
protected void apply() throws RepositoryException
Description copied from class:AbstractMaintenanceTask
Apply the tasks (within the execute method()).- Specified by:
apply
in classAbstractMaintenanceTask
- Throws:
RepositoryException
- If a repository exception
-
close
protected void close()
Description copied from class:AbstractMaintenanceTask
Close the tasks- Overrides:
close
in classAbstractMaintenanceTask
-
_reportDataStoreInfo
private long _reportDataStoreInfo(DataStore ds) throws DataStoreException
- Throws:
DataStoreException
-
_derbyCompressTable
private void _derbyCompressTable(DbDataStore ds) throws RepositoryException
Reclaiming unused space. This is derby specific. By default, Derby does not return unused space to the operating system when updating or deleting data.- Parameters:
ds
- The datastore- Throws:
RepositoryException
- If an error occurs with the repository
-
beforeScanning
public void beforeScanning(Node n) throws RepositoryException
- Specified by:
beforeScanning
in interfaceMarkEventListener
- Throws:
RepositoryException
-
getPM
protected PersistenceManager getPM(String workspaceName) throws RepositoryException
Retrieves JackRabbit Persistence Manager for currently opened repository. This method uses Privileged access and will fail with security exception if used in environment with enabled security manager.- Parameters:
workspaceName
- The workspace name- Returns:
- Persistence manager used by repository.
- Throws:
RepositoryException
- If an error occurs while retrieving the persistence manager
-
findAndInvokeMethod
private static Object findAndInvokeMethod(Object obj, String name, Object[] parameters) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException
-
-