Package com.bah.lucene.blockcache

Examples of com.bah.lucene.blockcache.BlockCache


    int blockSize = BlockDirectory.BLOCK_SIZE;
    int slabCount = configuration.getInt(BLUR_SHARD_BLOCKCACHE_SLAB_COUNT, -1);
    slabCount = getSlabCount(slabCount, numberOfBlocksPerSlab, blockSize, totalNumberOfBytes);
    Cache cache;
    if (slabCount >= 1) {
      BlockCache blockCache;
      boolean directAllocation = configuration.getBoolean(BLUR_SHARD_BLOCKCACHE_DIRECT_MEMORY_ALLOCATION, true);

      int slabSize = numberOfBlocksPerSlab * blockSize;
      LOG.info(MessageFormat.format("Number of slabs of block cache [{0}] with direct memory allocation set to [{1}]", slabCount,
          directAllocation));
      LOG.info(MessageFormat.format("Block cache target memory usage, slab size of [{0}] will allocate [{1}] slabs and use ~[{2}] bytes",
              slabSize, slabCount, ((long) slabCount * (long) slabSize)));

      try {
        long totalMemory = (long) slabCount * (long) numberOfBlocksPerSlab * (long) blockSize;
        blockCache = new BlockCache(directAllocation, totalMemory, slabSize);
      } catch (OutOfMemoryError e) {
        if ("Direct buffer memory".equals(e.getMessage())) {
          System.err
              .println("The max direct memory is too low.  Either increase by setting (-XX:MaxDirectMemorySize=<size>g -XX:+UseLargePages) or disable direct allocation by (blur.shard.blockcache.direct.memory.allocation=false) in blur-site.properties");
          System.exit(1);
View Full Code Here

TOP

Related Classes of com.bah.lucene.blockcache.BlockCache

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.