org.infinispan.lucene.locking
Class TransactionalLockFactory

java.lang.Object
  extended by org.apache.lucene.store.LockFactory
      extended by org.infinispan.lucene.locking.TransactionalLockFactory

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() );

Since:
4.0
Author:
Sanne Grinovero, Lukasz Moren
See Also:
InfinispanDirectory, TransactionalSharedLuceneLock, SerialMergeScheduler

Field Summary
 
Fields inherited from class org.apache.lucene.store.LockFactory
lockPrefix
 
Constructor Summary
TransactionalLockFactory(Cache cache, String indexName)
           
 
Method Summary
 void clearLock(String lockName)
          
 org.infinispan.lucene.locking.TransactionalSharedLuceneLock makeLock(String lockName)
          
 
Methods inherited from class org.apache.lucene.store.LockFactory
getLockPrefix, setLockPrefix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionalLockFactory

public TransactionalLockFactory(Cache cache,
                                String indexName)
Method Detail

makeLock

public org.infinispan.lucene.locking.TransactionalSharedLuceneLock makeLock(String lockName)

Specified by:
makeLock in class org.apache.lucene.store.LockFactory

clearLock

public void clearLock(String lockName)
               throws IOException

Specified by:
clearLock in class org.apache.lucene.store.LockFactory
Throws:
IOException

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.