/** * {@inheritDoc} */ @Override public IndexInput openInput(final String name, final IOContext context) throws IOException { final IndexInputContext indexInputContext = impl.openInput(name); if (indexInputContext.readLocks == null) { return new SingleChunkIndexInput(indexInputContext); } else { return new InfinispanIndexInput(indexInputContext); } }
/** * {@inheritDoc} */ @Override public IndexInput openInput(final String name) throws IOException { final IndexInputContext indexInputContext = impl.openInput(name); if ( indexInputContext.readLocks == null ) { return new SingleChunkIndexInput(indexInputContext); } else { return new InfinispanIndexInputV3(indexInputContext); } }
/** * {@inheritDoc} */ @Override public IndexInput openInput(final String name, final IOContext context) throws IOException { final IndexInputContext indexInputContext = impl.openInput(name); if (indexInputContext.readLocks == null) { return new SingleChunkIndexInput(indexInputContext); } else { return new InfinispanIndexInput(indexInputContext); } }
/** * {@inheritDoc} */ @Override public IndexInput openInput(final String name, final IOContext context) throws IOException { final IndexInputContext indexInputContext = impl.openInput(name); if ( indexInputContext.readLocks == null ) { return new SingleChunkIndexInput(indexInputContext); } else { return new InfinispanIndexInputV4(indexInputContext); } }
/** * {@inheritDoc} */ @Override public IndexInput openInput(String name) throws IOException { final FileCacheKey fileKey = new FileCacheKey(indexName, name); FileMetadata fileMetadata = metadataCache.get(fileKey); if (fileMetadata == null) { throw new FileNotFoundException("Error loading metadata for index file: " + fileKey); } else if (fileMetadata.getSize() <= fileMetadata.getBufferSize()) { //files smaller than chunkSize don't need a readLock IndexInputContext iic = new IndexInputContext(chunksCache, fileKey, fileMetadata, null); return new SingleChunkIndexInput(iic); } else { boolean locked = readLocks.acquireReadLock(name); if (!locked) { // safest reaction is to tell this file doesn't exist anymore. throw new FileNotFoundException("Error loading metadata for index file: " + fileKey); } IndexInputContext iic = new IndexInputContext(chunksCache, fileKey, fileMetadata, readLocks); return new InfinispanIndexInputV3(iic); } }