congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DistributedSegmentReadLocker
Code IndexAdd Tabnine to your IDE (free)

How to use
DistributedSegmentReadLocker
in
org.infinispan.lucene.readlocks

Best Java code snippets using org.infinispan.lucene.readlocks.DistributedSegmentReadLocker (Showing top 20 results out of 315)

origin: org.infinispan/infinispan-embedded-query

/**
* 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);
}
origin: org.infinispan/infinispan-lucene-directory

/**
 * @return true if the lock was acquired, false if it's too late: the file
 * was deleted and this LocalReadLock should be removed too.
 */
boolean acquire() {
  if (value == 0) {
   boolean haveIt = delegate.acquireReadLock(name);
   if (haveIt) {
     value = 1;
     return true;
   } else {
     value = -1;
     return false;
   }
  } else if (value == -1) {
   // it was deleted just a two lines ago
   return false;
  } else {
   value++;
   return true;
  }
}
origin: org.infinispan/infinispan-lucene-directory

 void release() {
   value--;
   if (value <= 0) {
    localLocks.remove(name);
    delegate.deleteOrReleaseReadLock(name);
   }
 }
}
origin: org.infinispan/infinispan-lucene-directory

if (isMultiChunked(filename)) {
  int newValue = 0;
  FileReadLockKey readLockKey = new FileReadLockKey(indexName, filename, affinitySegmentId);
   realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId);
  realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId);
origin: org.infinispan/infinispan-lucene-v3

public DistributedSegmentReadLocker(Cache<Object, Integer> locksCache, Cache<?, ?> chunksCache, Cache<?, ?> metadataCache, String indexName) {
 if (locksCache == null)
   throw new IllegalArgumentException("locksCache must not be null");
 if (chunksCache == null)
   throw new IllegalArgumentException("chunksCache must not be null");
 if (metadataCache == null)
   throw new IllegalArgumentException("metadataCache must not be null");
 if (indexName == null)
   throw new IllegalArgumentException("index name must not be null");
 this.indexName = indexName;
 this.locksCache = locksCache.getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD, Flag.SKIP_INDEXING);
 this.chunksCache = chunksCache.getAdvancedCache().withFlags(Flag.SKIP_INDEXING);
 this.metadataCache = metadataCache.getAdvancedCache().withFlags(Flag.SKIP_INDEXING);
 verifyCacheHasNoEviction(this.locksCache);
}
origin: org.infinispan/infinispan-lucene-v3

realFileDelete(readLockKey, locksCache, chunksCache, metadataCache);
origin: org.infinispan/infinispan-embedded-query

if (isMultiChunked(filename)) {
  int newValue = 0;
  FileReadLockKey readLockKey = new FileReadLockKey(indexName, filename, affinitySegmentId);
   realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId);
  realFileDelete(indexName, filename, locksCache, chunksCache, metadataCache, forceSynchronousDeletes, affinitySegmentId);
origin: org.infinispan/infinispan-lucene-directory

public DistributedSegmentReadLocker(Cache<Object, Integer> locksCache, Cache<?, ?> chunksCache, Cache<?, ?> metadataCache, String indexName, int affinitySegmentId, boolean forceSynchronousDeletes) {
 this.affinitySegmentId = affinitySegmentId;
 this.forceSynchronousDeletes = forceSynchronousDeletes;
 if (locksCache == null)
   throw new IllegalArgumentException("locksCache must not be null");
 if (chunksCache == null)
   throw new IllegalArgumentException("chunksCache must not be null");
 if (metadataCache == null)
   throw new IllegalArgumentException("metadataCache must not be null");
 if (indexName == null)
   throw new IllegalArgumentException("index name must not be null");
 this.indexName = indexName;
 this.locksCache = locksCache.getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD, Flag.SKIP_INDEXING);
 this.chunksCache = chunksCache.getAdvancedCache().withFlags(Flag.SKIP_INDEXING);
 this.metadataCache = (AdvancedCache<FileCacheKey, FileMetadata>) metadataCache.getAdvancedCache().withFlags(Flag.SKIP_INDEXING);
 verifyCacheHasNoEviction(this.locksCache);
}
origin: org.infinispan/infinispan-lucene-v3

/**
* 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);
}
origin: org.infinispan/infinispan-embedded-query

 void release() {
   value--;
   if (value <= 0) {
    localLocks.remove(name);
    delegate.deleteOrReleaseReadLock(name);
   }
 }
}
origin: org.infinispan/infinispan-embedded-query

public DistributedSegmentReadLocker(Cache<Object, Integer> locksCache, Cache<?, ?> chunksCache, Cache<?, ?> metadataCache, String indexName, int affinitySegmentId, boolean forceSynchronousDeletes) {
 this.affinitySegmentId = affinitySegmentId;
 this.forceSynchronousDeletes = forceSynchronousDeletes;
 if (locksCache == null)
   throw new IllegalArgumentException("locksCache must not be null");
 if (chunksCache == null)
   throw new IllegalArgumentException("chunksCache must not be null");
 if (metadataCache == null)
   throw new IllegalArgumentException("metadataCache must not be null");
 if (indexName == null)
   throw new IllegalArgumentException("index name must not be null");
 this.indexName = indexName;
 this.locksCache = locksCache.getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD, Flag.SKIP_INDEXING);
 this.chunksCache = chunksCache.getAdvancedCache().withFlags(Flag.SKIP_INDEXING);
 this.metadataCache = (AdvancedCache<FileCacheKey, FileMetadata>) metadataCache.getAdvancedCache().withFlags(Flag.SKIP_INDEXING);
 verifyCacheHasNoEviction(this.locksCache);
}
origin: org.infinispan/infinispan-embedded-query

/**
 * @return true if the lock was acquired, false if it's too late: the file
 * was deleted and this LocalReadLock should be removed too.
 */
boolean acquire() {
  if (value == 0) {
   boolean haveIt = delegate.acquireReadLock(name);
   if (haveIt) {
     value = 1;
     return true;
   } else {
     value = -1;
     return false;
   }
  } else if (value == -1) {
   // it was deleted just a two lines ago
   return false;
  } else {
   value++;
   return true;
  }
}
origin: org.infinispan/infinispan-lucene-directory

/**
* 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);
}
origin: org.infinispan/infinispan-lucene-v3

 synchronized void release() {
   value--;
   if (value <= 0) {
    localLocks.remove(name);
    delegate.deleteOrReleaseReadLock(name);
   }
 }
}
origin: org.infinispan/infinispan-lucene-v3

/**
 * @return true if the lock was acquired, false if it's too late: the file
 * was deleted and this LocalReadLock should be removed too.
 */
synchronized boolean acquire() {
  if (value == 0) {
   boolean haveIt = delegate.acquireReadLock(name);
   if (haveIt) {
     value = 1;
     return true;
   } else {
     value = -1;
     return false;
   }
  } else if (value == -1) {
   // it was deleted just a two lines ago
   return false;
  } else {
   value++;
   return true;
  }
}
origin: org.infinispan/infinispan-lucene-directory

/**
* 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);
}
origin: org.infinispan/infinispan-embedded-query

/**
* 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);
}
origin: org.infinispan/infinispan-lucene-v3

/**
* 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);
}
origin: org.infinispan/infinispan-lucene-directory

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);
}
origin: org.infinispan/infinispan-embedded-query

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);
}
org.infinispan.lucene.readlocksDistributedSegmentReadLocker

Javadoc

DistributedSegmentReadLocker stores reference counters in the cache to keep track of the number of clients still needing to be able to read a segment. It makes extensive usage of Infinispan's atomic operations.

Locks stored this way are not optimally performing as it might spin on remote invocations, and might fail to cleanup some garbage in case a node is disconnected without having released the readlock.

Most used methods

  • <init>
  • acquireReadLock
    Acquires a readlock on all chunks for this file, to make sure chunks are not deleted while iterating
  • deleteOrReleaseReadLock
    Deletes or releases a read-lock for the specified filename, so that if it was marked as deleted and
  • realFileDelete
    The Directory#deleteFile(String) is not deleting the elements from the cache but instead flagging th
  • verifyCacheHasNoEviction
  • isMultiChunked
    Evaluates if the file is potentially being stored as fragmented into multiple chunks; when it's a si

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (Timer)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now