final Lock lock = dbTokens.getLock();
try {
lock.acquire(Lock.WRITE_LOCK);
// remove generic index
Value value = new WordRef(collection.getId());
dbTokens.removeAll(null, new IndexQuery(IndexQuery.TRUNC_RIGHT, value));
// remove QName index
value = new QNameWordRef(collection.getId());
dbTokens.removeAll(null, new IndexQuery(IndexQuery.TRUNC_RIGHT, value));
} catch (final LockException e) {
LOG.warn("Failed to acquire lock for '" + dbTokens.getFile().getName() + "'", e);
//TODO : throw exception ? -pb
} catch (final BTreeException e) {
LOG.error(e.getMessage(), e);