/** * {@inheritDoc} */ @Override public synchronized void deleteOrReleaseReadLock(String name) { getLocalLockByName(name).release(); }
/** * Create a new LocalLockMergingSegmentReadLocker with special purpose caches * @param locksCache the cache to be used to store distributed locks * @param chunksCache the cache containing the chunks, this is where the bulk of data is stored * @param metadataCache smaller cache for the metadata of stored elements * @param indexName */ public LocalLockMergingSegmentReadLocker(Cache<?, ?> locksCache, Cache<?, ?> chunksCache, Cache<?, ?> metadataCache, String indexName, int affinitySegmentId) { this.delegate = new DistributedSegmentReadLocker((Cache<Object, Integer>) locksCache, chunksCache, metadataCache, indexName, affinitySegmentId); }
/** * {@inheritDoc} */ @Override public synchronized boolean acquireReadLock(String name) { LocalReadLock localReadLock = getLocalLockByName(name); boolean acquired = localReadLock.acquire(); if (acquired) { return true; } else { // cleanup localLocks.remove(name); return false; } }
void release() { value--; if (value <= 0) { localLocks.remove(name); delegate.deleteOrReleaseReadLock(name); } } }
@Test public void testAdditionalIndexWritingAndFinding() throws IOException, InterruptedException { prepareEnvironment(true); testIndexWritingAndFinding(); }
void verifyIgnoringFiles(Cache cache0, Cache cache1, Set<String> files) { verifyIgnoringFiles(cache0, files); verifyIgnoringFiles(cache1, files); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder configurationBuilder = CacheTestSupport.createTestConfiguration(TransactionMode.NON_TRANSACTIONAL); createClusteredCaches(2, CACHE_NAME, configurationBuilder); }
/** * Create a new LocalLockMergingSegmentReadLocker for specified cache and index name. * * @param cache * @param indexName */ public LocalLockMergingSegmentReadLocker(Cache<?, ?> cache, String indexName) { this.delegate = new DistributedSegmentReadLocker((Cache<Object, Integer>) cache, cache, cache, indexName); }
/** * {@inheritDoc} */ @Override public void deleteOrReleaseReadLock(String name) { getLocalLockByName(name).release(); }
/** * {@inheritDoc} */ @Override public synchronized boolean acquireReadLock(String name) { LocalReadLock localReadLock = getLocalLockByName(name); boolean acquired = localReadLock.acquire(); if (acquired) { return true; } else { // cleanup localLocks.remove(name); return false; } }
/** * Create a new LocalLockMergingSegmentReadLocker with special purpose caches * @param locksCache the cache to be used to store distributed locks * @param chunksCache the cache containing the chunks, this is where the bulk of data is stored * @param metadataCache smaller cache for the metadata of stored elements * @param indexName */ public LocalLockMergingSegmentReadLocker(Cache<?, ?> locksCache, Cache<?, ?> chunksCache, Cache<?, ?> metadataCache, String indexName, int affinitySegmentId) { this.delegate = new DistributedSegmentReadLocker((Cache<Object, Integer>) locksCache, chunksCache, metadataCache, indexName, affinitySegmentId); }
/** * {@inheritDoc} */ @Override public synchronized void deleteOrReleaseReadLock(String name) { getLocalLockByName(name).release(); }
/** * {@inheritDoc} */ @Override public boolean acquireReadLock(String name) { LocalReadLock localReadLock = getLocalLockByName(name); boolean acquired = localReadLock.acquire(); if (acquired) { return true; } else { // cleanup localLocks.remove(name); return false; } }
/** * Create a new LocalLockMergingSegmentReadLocker for specified cache and index name. * * @param cache * @param indexName */ public LocalLockMergingSegmentReadLocker(Cache<?, ?> cache, String indexName, int affinitySegmentId) { this.delegate = new DistributedSegmentReadLocker((Cache<Object, Integer>) cache, cache, cache, indexName, affinitySegmentId); }
/** * Create a new LocalLockMergingSegmentReadLocker for specified cache and index name. * * @param cache * @param indexName */ public LocalLockMergingSegmentReadLocker(Cache<?, ?> cache, String indexName, int affinitySegmentId) { this.delegate = new DistributedSegmentReadLocker((Cache<Object, Integer>) cache, cache, cache, indexName, affinitySegmentId); }
/** * Create a new LocalLockMergingSegmentReadLocker with special purpose caches * @param locksCache the cache to be used to store distributed locks * @param chunksCache the cache containing the chunks, this is where the bulk of data is stored * @param metadataCache smaller cache for the metadata of stored elements * @param indexName */ public LocalLockMergingSegmentReadLocker(Cache<?, ?> locksCache, Cache<?, ?> chunksCache, Cache<?, ?> metadataCache, String indexName) { this.delegate = new DistributedSegmentReadLocker((Cache<Object, Integer>) locksCache, chunksCache, metadataCache, indexName); }
public LocalLockMergingSegmentReadLocker(Cache<?, ?> locksCache, Cache<?, ?> chunksCache, Cache<?, ?> metadataCache, String indexName, boolean forceSynchronousDeletes, int affinitySegmentId) { this.delegate = new DistributedSegmentReadLocker((Cache<Object, Integer>) locksCache, chunksCache, metadataCache, indexName, affinitySegmentId,forceSynchronousDeletes); }
public LocalLockMergingSegmentReadLocker(Cache<?, ?> locksCache, Cache<?, ?> chunksCache, Cache<?, ?> metadataCache, String indexName, boolean forceSynchronousDeletes, int affinitySegmentId) { this.delegate = new DistributedSegmentReadLocker((Cache<Object, Integer>) locksCache, chunksCache, metadataCache, indexName, affinitySegmentId,forceSynchronousDeletes); }
private SegmentReadLocker makeTestableReadLocker(Cache cache, String indexName) { return new DistributedSegmentReadLocker(cache, cache, cache, indexName, -1 ,true); }
private static SegmentReadLocker makeDefaultSegmentReadLocker(Cache<?, ?> metadataCache, Cache<?, ?> chunksCache, Cache<?, ?> distLocksCache, String indexName) { checkNotNull(distLocksCache, "distLocksCache"); checkNotNull(indexName, "indexName"); return new DistributedSegmentReadLocker((Cache<Object, Integer>) distLocksCache, chunksCache, metadataCache, indexName); }