public class TransactionalLockFactory
extends org.apache.lucene.store.LockFactory
Factory for locks obtained in InfinispanDirectory
,
this factory produces instances of TransactionalSharedLuceneLock
.
Usually Lucene acquires the lock when creating an IndexWriter and releases it when closing it; these open-close operations are mapped to transactions as begin-commit, so all changes are going to be effective at IndexWriter close. The advantage is that a transaction rollback will be able to undo all changes applied to the index, but this requires enough memory to hold all the changes until the commit.
Using a TransactionalSharedLuceneLock is not compatible with Lucene's
default MergeScheduler: use an in-thread implementation like SerialMergeScheduler
indexWriter.setMergeScheduler( new SerialMergeScheduler() );
TransactionalSharedLuceneLock
,
SerialMergeScheduler
Constructor and Description |
---|
TransactionalLockFactory(Cache<?,?> cache,
String indexName) |
public org.infinispan.lucene.locking.TransactionalSharedLuceneLock makeLock(String lockName)
makeLock
in class org.apache.lucene.store.LockFactory
public void clearLock(String lockName)
clearLock
in class org.apache.lucene.store.LockFactory
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.