congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DirectoryLoaderAdaptor.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.infinispan.lucene.cacheloader.DirectoryLoaderAdaptor
constructor

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

origin: org.infinispan/infinispan-lucene-directory

/**
* Looks up the Directory adapter if it's already known, or attempts to initialize indexes.
*/
private DirectoryLoaderAdaptor getDirectory(final String indexName) {
 DirectoryLoaderAdaptor adapter = openDirectories.get(indexName);
 if (adapter == null) {
   synchronized (openDirectories) {
    adapter = openDirectories.get(indexName);
    if (adapter == null) {
      final File path = new File(this.rootDirectory, indexName);
      final FSDirectory directory = openLuceneDirectory(path);
      adapter = new DirectoryLoaderAdaptor(directory, indexName, autoChunkSize, affinitySegmentId);
      openDirectories.put(indexName, adapter);
    }
   }
 }
 return adapter;
}
origin: org.infinispan/infinispan-embedded-query

/**
* Looks up the Directory adapter if it's already known, or attempts to initialize indexes.
*/
private DirectoryLoaderAdaptor getDirectory(final String indexName) {
 DirectoryLoaderAdaptor adapter = openDirectories.get(indexName);
 if (adapter == null) {
   synchronized (openDirectories) {
    adapter = openDirectories.get(indexName);
    if (adapter == null) {
      final File path = new File(this.rootDirectory, indexName);
      final FSDirectory directory = openLuceneDirectory(path);
      adapter = new DirectoryLoaderAdaptor(directory, indexName, autoChunkSize, affinitySegmentId);
      openDirectories.put(indexName, adapter);
    }
   }
 }
 return adapter;
}
origin: org.infinispan/infinispan-lucene-v3

/**
* Looks up the Directory adapter if it's already known, or attempts to initialize indexes.
*/
private DirectoryLoaderAdaptor getDirectory(final String indexName) {
 DirectoryLoaderAdaptor adapter = openDirectories.get(indexName);
 if (adapter == null) {
   synchronized (openDirectories) {
    adapter = openDirectories.get(indexName);
    if (adapter == null) {
      final File path = new File(this.rootDirectory, indexName);
      final FSDirectory directory = openLuceneDirectory(path);
      final InternalDirectoryContract wrapped = ContractAdaptorFactory.wrapNativeDirectory(directory);
      adapter = new DirectoryLoaderAdaptor(wrapped, indexName, autoChunkSize);
      openDirectories.put(indexName, adapter);
    }
   }
 }
 return adapter;
}
origin: org.infinispan/infinispan-lucene-directory

public void testAutoChunkingOnLargeFiles() throws IOException {
 Directory mockDirectory = createMockDirectory();
 FileCacheKey k = new FileCacheKey(INDEX_NAME, FILE_NAME, segmentId);
 DirectoryLoaderAdaptor adaptor = new DirectoryLoaderAdaptor(mockDirectory, INDEX_NAME, AUTO_BUFFER, -1);
 Object loaded = adaptor.load(k);
 AssertJUnit.assertTrue(loaded instanceof FileMetadata);
 FileMetadata metadata = (FileMetadata)loaded;
 AssertJUnit.assertEquals(TEST_SIZE, metadata.getSize());
 AssertJUnit.assertEquals(AUTO_BUFFER, metadata.getBufferSize());
}
origin: org.infinispan/infinispan-lucene-directory

public void testSmallChunkLoading() throws IOException {
 Directory mockDirectory = createMockDirectory();
 DirectoryLoaderAdaptor adaptor = new DirectoryLoaderAdaptor(mockDirectory, INDEX_NAME, AUTO_BUFFER, -1);
 Object loaded = adaptor.load(new ChunkCacheKey(INDEX_NAME, FILE_NAME, 0, AUTO_BUFFER, segmentId));
 AssertJUnit.assertTrue(loaded instanceof byte[]);
 AssertJUnit.assertEquals(AUTO_BUFFER, ((byte[])loaded).length);
 loaded = adaptor.load(new ChunkCacheKey(INDEX_NAME, FILE_NAME, 5, AUTO_BUFFER, segmentId));
 AssertJUnit.assertTrue(loaded instanceof byte[]);
 AssertJUnit.assertEquals(AUTO_BUFFER, ((byte[])loaded).length);
 final int lastChunk = (int)(TEST_SIZE / AUTO_BUFFER);
 final long lastChunkSize = TEST_SIZE % AUTO_BUFFER;
 AssertJUnit.assertEquals(9, lastChunkSize);
 loaded = adaptor.load(new ChunkCacheKey(INDEX_NAME, FILE_NAME, lastChunk, AUTO_BUFFER, segmentId));
 AssertJUnit.assertTrue(loaded instanceof byte[]);
 AssertJUnit.assertEquals(lastChunkSize, ((byte[])loaded).length);
}
org.infinispan.lucene.cacheloaderDirectoryLoaderAdaptor<init>

Javadoc

Create a new DirectoryLoaderAdaptor.

Popular methods of DirectoryLoaderAdaptor

  • figureChunksNumber
    Index segment files might be larger than 2GB; so it's possible to have an autoChunksize which is too
  • load
    Load the value for a specific key
  • close
    Closes the underlying Directory. After it's closed, no other invocations are expected on this Adapte
  • containsKey
  • containsKeyIntern
    ContainsKey implementation for chunk elements
  • loadAllEntries
    Loads all "entries" from the CacheLoader; considering this is actually a Lucene index, that's going
  • loadSomeKeys
    Load some keys in the collector, excluding some and to a maximum number of collected (non-excluded)

Popular in Java

  • Finding current android device location
  • putExtra (Intent)
  • requestLocationUpdates (LocationManager)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top 17 Free Sublime Text 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