public class LocalLockMergingSegmentReadLocker extends Object implements SegmentReadLocker
DistributedSegmentReadLocker to minimize
remote operations in case several IndexReaders are opened on the same Infinispan based Directory.
It keeps track of locks which where already acquired for a specific filename from another request on
the same node and merges the request so that the different clients share the same remote lock.| Constructor and Description |
|---|
LocalLockMergingSegmentReadLocker(Cache<?,?> locksCache,
Cache<?,?> chunksCache,
Cache<?,?> metadataCache,
String indexName,
boolean forceSynchronousDeletes,
int affinitySegmentId) |
LocalLockMergingSegmentReadLocker(Cache<?,?> locksCache,
Cache<?,?> chunksCache,
Cache<?,?> metadataCache,
String indexName,
int affinitySegmentId)
Create a new LocalLockMergingSegmentReadLocker with special purpose caches
|
LocalLockMergingSegmentReadLocker(Cache<?,?> cache,
String indexName,
int affinitySegmentId)
Create a new LocalLockMergingSegmentReadLocker for specified cache and index name.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
acquireReadLock(String name)
Acquires a readlock, in order to prevent other invocations to
SegmentReadLocker.deleteOrReleaseReadLock(String)
from deleting the file. |
void |
deleteOrReleaseReadLock(String name)
It will release a previously acquired readLock, or
if no readLock was acquired it will mark the file to be deleted as soon
as all pending locks are releases.
|
public LocalLockMergingSegmentReadLocker(Cache<?,?> cache, String indexName, int affinitySegmentId)
cache - indexName - public LocalLockMergingSegmentReadLocker(Cache<?,?> locksCache, Cache<?,?> chunksCache, Cache<?,?> metadataCache, String indexName, int affinitySegmentId)
locksCache - the cache to be used to store distributed lockschunksCache - the cache containing the chunks, this is where the bulk of data is storedmetadataCache - smaller cache for the metadata of stored elementsindexName - public boolean acquireReadLock(String name)
SegmentReadLocker.deleteOrReleaseReadLock(String)
from deleting the file.acquireReadLock in interface SegmentReadLockername - of the file to acquire the lock atDirectory.openInput(java.lang.String, org.apache.lucene.store.IOContext)public void deleteOrReleaseReadLock(String name)
deleteOrReleaseReadLock in interface SegmentReadLockername - of the file to release or deleteDirectory.deleteFile(String)Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.