Package org.apache.blur.store.blockcache_v2.cachevalue

Examples of org.apache.blur.store.blockcache_v2.cachevalue.UnsafeCacheValue


  public CacheValue newInstance(CacheDirectory directory, String fileName, int cacheBlockSize) {
    switch (_store) {
    case ON_HEAP:
      return new ByteArrayCacheValue(cacheBlockSize);
    case OFF_HEAP:
      return new UnsafeCacheValue(cacheBlockSize);
    default:
      throw new RuntimeException("Unknown type [" + _store + "]");
    }
  }
View Full Code Here


      @Override
      public boolean shouldBeQuiet(CacheDirectory directory, String fileName) {
        return false;
      }
    };
    _cache = new BaseCache(totalNumberOfBytes, fileBufferSize, cacheBlockSize, readFilter, writeFilter, quiet,
        getStore());
    Directory dir = FSDirectory.open(new File(file, "cache"));

    BufferStore.initNewBuffer(1024, 1024 * 128);
    BufferStore.initNewBuffer(8192, 8192 * 128);
 
View Full Code Here

        }
        return false;
      }
    };

    _cache = new BaseCache(totalNumberOfBytes, fileBufferSize, cacheBlockSize, readFilter, writeFilter, quiet, store);
  }
View Full Code Here

        cacheBlockSizeMap.put(fieldType, cacheBlockSizeForFile);
        LOG.info("{0}={1} for file type [{2}]", key, cacheBlockSizeForFile, fieldType);
      }
    }

    final STORE store = STORE.valueOf(configuration.get(BLUR_SHARD_BLOCK_CACHE_V2_STORE, OFF_HEAP));
    LOG.info("{0}={1}", BLUR_SHARD_BLOCK_CACHE_V2_STORE, store);

    final Set<String> cachingFileExtensionsForRead = getSet(configuration.get(
        BLUR_SHARD_BLOCK_CACHE_V2_READ_CACHE_EXT, DEFAULT_VALUE));
    LOG.info("{0}={1}", BLUR_SHARD_BLOCK_CACHE_V2_READ_CACHE_EXT, cachingFileExtensionsForRead);
View Full Code Here

        getStore());
    Directory dir = FSDirectory.open(new File(file, "cache"));

    BufferStore.initNewBuffer(1024, 1024 * 128);
    BufferStore.initNewBuffer(8192, 8192 * 128);
    return new CacheDirectory("test", "test", wrapLastModified(dir), _cache, null);
  }
View Full Code Here

  }

  @Override
  public Directory newDirectory(String table, String shard, Directory directory, Set<String> tableBlockCacheFileTypes)
      throws IOException {
    return new CacheDirectory(table, shard, directory, _cache, tableBlockCacheFileTypes);
  }
View Full Code Here

  public CacheValue detachFromCache() {
    if (_baseCacheValue instanceof ByteArrayCacheValue) {
      // already detached
      return null;
    } else if (_baseCacheValue instanceof UnsafeCacheValue) {
      final CacheValue result = _baseCacheValue;
      if (get() == 0) {
        // No one is using this so don't copy
        // NULL out reference so just in case there can't be a seg fault.
        _baseCacheValue = null;
      } else {
View Full Code Here

      public int getSize(CacheDirectory directory, String fileName) {
        return cacheBlockSizeInt;
      }
    };

    FileNameFilter writeFilter = new FileNameFilter() {
      @Override
      public boolean accept(CacheDirectory directory, String fileName) {
        return true;
      }
    };
    FileNameFilter readFilter = new FileNameFilter() {
      @Override
      public boolean accept(CacheDirectory directory, String fileName) {
        return true;
      }
    };
View Full Code Here

        }
        return cacheBlockSizeInt;
      }
    };

    FileNameFilter readFilter = new FileNameFilter() {
      @Override
      public boolean accept(CacheDirectory directory, String fileName) {
        String ext = getExt(fileName);
        if (cachingFileExtensionsForRead.contains(ext)) {
          return true;
        } else if (nonCachingFileExtensionsForRead.contains(ext)) {
          return false;
        }
        return defaultReadCaching;
      }
    };

    FileNameFilter writeFilter = new FileNameFilter() {
      @Override
      public boolean accept(CacheDirectory directory, String fileName) {
        String ext = getExt(fileName);
        if (cachingFileExtensionsForWrite.contains(ext)) {
          return true;
View Full Code Here

      @Override
      public boolean accept(CacheDirectory directory, String fileName) {
        return true;
      }
    };
    Quiet quiet = new Quiet() {
      @Override
      public boolean shouldBeQuiet(CacheDirectory directory, String fileName) {
        return false;
      }
    };
View Full Code Here

TOP

Related Classes of org.apache.blur.store.blockcache_v2.cachevalue.UnsafeCacheValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.