congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
FileListCacheKey.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.infinispan.lucene.FileListCacheKey
constructor

Best Java code snippets using org.infinispan.lucene.FileListCacheKey.<init> (Showing top 20 results out of 315)

origin: org.infinispan/infinispan-lucene-v3

@Override
public FileListCacheKey readObject(final ObjectInput input) throws IOException {
  String indexName = input.readUTF();
  return new FileListCacheKey(indexName);
}
origin: org.infinispan/infinispan-lucene-directory

@Override
public FileListCacheKey readObject(final ObjectInput input) throws IOException {
  final String indexName = input.readUTF();
  final int affinitySegmentId = UnsignedNumeric.readUnsignedInt(input);
  return new FileListCacheKey(indexName, affinitySegmentId);
}
origin: org.infinispan/infinispan-embedded-query

@Override
public FileListCacheKey readObject(final ObjectInput input) throws IOException {
  final String indexName = input.readUTF();
  final int affinitySegmentId = UnsignedNumeric.readUnsignedInt(input);
  return new FileListCacheKey(indexName, affinitySegmentId);
}
origin: org.infinispan/infinispan-lucene-directory

@SuppressWarnings("unchecked")
public FileListOperations(AdvancedCache<?, ?> cache, String indexName, boolean writeAsync, int affinitySegmentId) {
 this.writeAsync = writeAsync;
 this.affinitySegmentId = affinitySegmentId;
 this.cache = (AdvancedCache<FileListCacheKey, Object>) cache;
 this.cacheNoRetrieve = (AdvancedCache<FileListCacheKey, FileListCacheValue>) cache.withFlags(Flag.IGNORE_RETURN_VALUES);
 this.indexName = indexName;
 this.fileListCacheKey = new FileListCacheKey(indexName, affinitySegmentId);
 ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
 readLock = lock.readLock();
 writeLock = lock.writeLock();
}
origin: org.infinispan/infinispan-embedded-query

@SuppressWarnings("unchecked")
public FileListOperations(AdvancedCache<?, ?> cache, String indexName, boolean writeAsync, int affinitySegmentId) {
 this.writeAsync = writeAsync;
 this.affinitySegmentId = affinitySegmentId;
 this.cache = (AdvancedCache<FileListCacheKey, Object>) cache;
 this.cacheNoRetrieve = (AdvancedCache<FileListCacheKey, FileListCacheValue>) cache.withFlags(Flag.IGNORE_RETURN_VALUES);
 this.indexName = indexName;
 this.fileListCacheKey = new FileListCacheKey(indexName, affinitySegmentId);
 ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
 readLock = lock.readLock();
 writeLock = lock.writeLock();
}
origin: org.infinispan/infinispan-lucene-v3

public FileListOperations(AdvancedCache<?, ?> cache, String indexName){
 this.cache = (AdvancedCache<FileListCacheKey, Object>) cache;
 this.cacheNoRetrieve = (AdvancedCache<FileListCacheKey, Set<String>>) cache.withFlags(Flag.IGNORE_RETURN_VALUES);
 this.indexName = indexName;
 this.fileListCacheKey = new FileListCacheKey(indexName);
}
origin: org.infinispan/infinispan-lucene-directory

@Test
public void testFileListCacheKeyExternalizer() throws IOException {
 FileListCacheKey key = new FileListCacheKey("myIndex", 7);
 verifyExternalizerForType(key, FileListCacheKey.Externalizer.class);
}
origin: org.infinispan/infinispan-lucene-directory

FileListCacheKey rootKey = new FileListCacheKey(indexName, affinitySegmentId);
if (keysToExclude == null || !keysToExclude.contains(rootKey)) { //unless it was excluded
  if (keysCollector.add(rootKey)) { //unless it was already collected
origin: org.infinispan/infinispan-lucene-v3

FileListCacheKey rootKey = new FileListCacheKey(indexName);
if (keysToExclude==null || ! keysToExclude.contains(rootKey)) { //unless it was excluded
  if (keysCollector.add(rootKey) ) { //unless it was already collected
origin: org.infinispan/infinispan-embedded-query

FileListCacheKey rootKey = new FileListCacheKey(indexName, affinitySegmentId);
if (keysToExclude == null || !keysToExclude.contains(rootKey)) { //unless it was excluded
  if (keysCollector.add(rootKey)) { //unless it was already collected
origin: org.infinispan/infinispan-lucene-directory

@Test
public void loadFileListCacheKey() {
 AssertJUnit.assertEquals(new FileListCacheKey("", -1), mapper.getKeyMapping("*||-1"));
 AssertJUnit.assertEquals(new FileListCacheKey("the leaves of Amazonia", -1), mapper.getKeyMapping("*|the leaves of Amazonia|-1"));
}
origin: org.infinispan/infinispan-lucene-directory

@Test
public void testFileListCacheKeyComparison() {
 AssertJUnit.assertFalse("The instance of FileListCacheKey should not be equal to null.", new FileListCacheKey("index-A", -1).equals(null));
 AssertJUnit.assertFalse("The instance of FileListCacheKey should not be equal to FileCacheKey instance.", new FileListCacheKey("index-A", -1).equals(new FileCacheKey("index-A", "test.txt", -1)));
}
origin: org.infinispan/infinispan-lucene-directory

public void testLoadAllKeysWithExclusionOfRootKey() throws Exception {
 TestHelper.createIndex(rootDir, indexName, elementCount, true);
 LuceneCacheLoader cacheLoader = (LuceneCacheLoader) TestingUtil.getFirstLoader(cacheManager.getCache());
 Set keySet = PersistenceUtil.toKeySet(cacheLoader, null);
 int initialCount = keySet.size();
 HashSet exclusionSet = new HashSet();
 exclusionSet.add(new FileListCacheKey(indexName, segmentId));
 keySet = PersistenceUtil.toKeySet(cacheLoader, k -> !exclusionSet.contains(k));
 String[] fileNamesArr = TestHelper.getFileNamesFromDir(rootDir, indexName);
 AssertJUnit.assertEquals((initialCount - 1), keySet.size());
 Iterator it = keySet.iterator();
 while (it.hasNext()) {
   assert !(it.next() instanceof FileListCacheKey);
 }
}
origin: org.infinispan/infinispan-lucene-directory

final String indexName = split[1];
final int affinitySegmentId = toInt(split[2], key);
return new FileListCacheKey(indexName, affinitySegmentId);
origin: org.infinispan/infinispan-embedded-query

final String indexName = split[1];
final int affinitySegmentId = toInt(split[2], key);
return new FileListCacheKey(indexName, affinitySegmentId);
origin: org.infinispan/infinispan-lucene-directory

public static void assertFileNotExists(Cache cache, String indexName, String fileName, long maxWaitForCondition, int affinitySegmentId) throws InterruptedException {
 FileListCacheValue fileList = (FileListCacheValue) cache.get(new FileListCacheKey(indexName, affinitySegmentId));
 AssertJUnit.assertNotNull(fileList);
 AssertJUnit.assertFalse(fileList.contains(fileName)); //check is in sync: no waiting allowed in this case
 boolean allok = false;
 while (maxWaitForCondition >= 0 && !allok) {
   Thread.sleep(10);
   maxWaitForCondition -= 10;
   allok=true;
   FileMetadata metadata = (FileMetadata) cache.get(new FileCacheKey(indexName, fileName, affinitySegmentId));
   if (metadata!=null) allok=false;
   for (int i = 0; i < 100; i++) {
    //bufferSize set to 0 as metadata might not be available, and it's not part of equals/hashcode anyway.
    ChunkCacheKey key = new ChunkCacheKey(indexName, fileName, i, 0, affinitySegmentId);
    if (cache.get(key)!=null) allok=false;
   }
 }
 assertTrue(allok);
}
origin: org.infinispan/infinispan-lucene-directory

public void testContainsKeyCacheKeyTypes() throws Exception {
 TestHelper.createIndex(rootDir, indexName, elementCount, true);
 LuceneCacheLoader cacheLoader = (LuceneCacheLoader) TestingUtil.getFirstLoader(cacheManager.getCache());
 assert cacheLoader.contains(new FileListCacheKey(indexName, segmentId));
 String[] fileNamesFromIndexDir = TestHelper.getFileNamesFromDir(rootDir, indexName);
 for(String fileName : fileNamesFromIndexDir) {
   assert !cacheLoader.contains(new FileReadLockKey(indexName, fileName, segmentId)) : "Failed for " + fileName;
   assert cacheLoader.contains(new ChunkCacheKey(indexName, fileName, 0, 1024, segmentId)) : "Failed for " + fileName;
 }
 assert !cacheLoader.contains(new ChunkCacheKey(indexName, "testFile.txt", 0, 1024, segmentId));
}
origin: org.infinispan/infinispan-lucene-directory

private void assertFileAfterDeletion(Cache cache) {
 FileListCacheValue fileList = (FileListCacheValue) cache.get(new FileListCacheKey(INDEX_NAME, -1));
 AssertJUnit.assertNotNull(fileList);
 AssertJUnit.assertFalse(fileList.contains(filename));
 FileMetadata metadata = (FileMetadata) cache.get(new FileCacheKey(INDEX_NAME, filename, -1));
 AssertJUnit.assertNotNull(metadata);
 long totalFileSize = metadata.getSize();
 int chunkNumbers = (int)(totalFileSize / CHUNK_SIZE);
 for(int i = 0; i < chunkNumbers; i++) {
   AssertJUnit.assertNotNull(cache.get(new ChunkCacheKey(INDEX_NAME, filename, i, CHUNK_SIZE, -1)));
 }
 boolean fileNameExistsInCache = false;
 for(Object key : cache.keySet()) {
   if(key instanceof FileCacheKey) {
    FileCacheKey keyObj = (FileCacheKey) key;
    if(keyObj.getFileName().contains(filename)) {
      fileNameExistsInCache = true;
    }
   }
 }
 AssertJUnit.assertTrue(fileNameExistsInCache);
}
origin: org.infinispan/infinispan-lucene-directory

/**
* Verified the file exists and has a specified value for readLock;
* Consider that null should be interpreted as value 1;
*/
public static void assertFileExistsHavingRLCount(Cache cache, String fileName, String indexName, int expectedReadcount, int chunkSize, boolean expectRegisteredInFat, int affinitySegmentId) {
 FileListCacheValue fileList = (FileListCacheValue) cache.get(new FileListCacheKey(indexName,affinitySegmentId));
 assertNotNull(fileList);
 assertTrue(fileList.contains(fileName) == expectRegisteredInFat);
 FileMetadata metadata = (FileMetadata) cache.get(new FileCacheKey(indexName, fileName, affinitySegmentId));
 assertNotNull(metadata);
 long totalFileSize = metadata.getSize();
 int chunkNumbers = (int)(totalFileSize / chunkSize);
 for (int i = 0; i < chunkNumbers; i++) {
   assertNotNull(cache.get(new ChunkCacheKey(indexName, fileName, i, metadata.getBufferSize(), affinitySegmentId)));
 }
 FileReadLockKey readLockKey = new FileReadLockKey(indexName,fileName, affinitySegmentId);
 Object value = cache.get(readLockKey);
 if (expectedReadcount <= 1) {
   assertTrue("readlock value is " + value, value == null || Integer.valueOf(1).equals(value));
 }
 else {
   assertNotNull(value);
   assertTrue(value instanceof Integer);
   int v = (Integer)value;
   assertEquals(v, expectedReadcount);
 }
}
origin: org.infinispan/infinispan-lucene-directory

public static void verifyDirectoryStructure(Cache cache, String indexName, boolean wasAStressTest, Set<String> ignoreFiles, int affinitySegmentId) {
 FileListCacheValue fileList = (FileListCacheValue) cache.get(new FileListCacheKey(indexName, affinitySegmentId));
 assertNotNull(fileList);
 int fileListCacheKeyInstances = 0;
org.infinispan.luceneFileListCacheKey<init>

Popular methods of FileListCacheKey

  • generatedHashCode
  • equals

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top 17 PhpStorm 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