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| Modifier and Type | Field and Description |
|---|---|
static TransactionalLockFactory |
INSTANCE |
| Constructor and Description |
|---|
TransactionalLockFactory() |
| Modifier and Type | Method and Description |
|---|---|
org.infinispan.lucene.impl.TransactionalSharedLuceneLock |
obtainLock(org.apache.lucene.store.Directory dir,
String lockName) |
public static final TransactionalLockFactory INSTANCE
public org.infinispan.lucene.impl.TransactionalSharedLuceneLock obtainLock(org.apache.lucene.store.Directory dir,
String lockName)
throws IOException
obtainLock in class org.apache.lucene.store.LockFactoryIOExceptionCopyright © 2025 JBoss, a division of Red Hat. All rights reserved.