I run this code every 5 minutes (the first three lines get the session of a
SuperUser internal application session):
try {
SessionManager sm = SessionManager.getInstance();
String sysToken = sm.getSystemToken();
SessionImpl si = (SessionImpl)sm.get(sysToken);
GarbageCollector gc = si.createDataStoreGarbageCollector();
// optional (if you want to implement a progress bar / output)
gc.setScanEventListener(this);
gc.scan();
gc.stopScan();
// delete old data
int deleted = gc.deleteUnused();
log.info("Deleted garbage documents: "+deleted);
} catch (IOException e) {
log.error(e.getMessage(), e);
} catch (IllegalStateException e) {
log.error(e.getMessage(), e);
} catch (ItemStateException e) {
log.error(e.getMessage(), e);
} catch (RepositoryException e) {
log.error(e.getMessage(), e);
}
but it never remove anything from the datastore. I have deleted some
document from the repository and I don't understand why they are not deleted
from the datastore. Also I have logged out from the system to verify there
is no cached references to these deleted documents.
--
Paco Avila
GIT Consultors
tel: +34 971 498310
fax: +34 971496189
e-mail: [email protected]
http://www.git.es