List of usage examples for com.google.common.collect MinMaxPriorityQueue expectedSize
public static Builder<Comparable> expectedSize(int expectedSize)
From source file:org.apache.hadoop.hbase.io.hfile.CachedBlockQueue.java
/** * @param maxSize the target size of elements in the queue * @param blockSize expected average size of blocks *//*from w w w .j ava2 s . c om*/ public CachedBlockQueue(long maxSize, long blockSize) { int initialSize = (int) (maxSize / blockSize); if (initialSize == 0) initialSize++; queue = MinMaxPriorityQueue.expectedSize(initialSize).create(); heapSize = 0; this.maxSize = maxSize; }
From source file:org.apache.hadoop.hbase.io.hfile.LruCachedBlockQueue.java
/** * @param maxSize the target size of elements in the queue * @param blockSize expected average size of blocks *//* www. java2s . c o m*/ public LruCachedBlockQueue(long maxSize, long blockSize) { int initialSize = (int) (maxSize / blockSize); if (initialSize == 0) initialSize++; queue = MinMaxPriorityQueue.expectedSize(initialSize).create(); heapSize = 0; this.maxSize = maxSize; }
From source file:com.comphenix.protocol.async.PacketProcessingQueue.java
public PacketProcessingQueue(PlayerSendingHandler sendingHandler, int initialSize, int maximumSize, int maximumConcurrency) { super();//from www . jav a2s . co m try { this.processingQueue = Synchronization.queue(MinMaxPriorityQueue.expectedSize(initialSize) .maximumSize(maximumSize).<PacketEventHolder>create(), null); } catch (IncompatibleClassChangeError e) { // Print in the console ProtocolLibrary.getErrorReporter().reportWarning(this, Report.newBuilder(REPORT_GUAVA_CORRUPT_MISSING).error(e)); // It's a Beta class after all this.processingQueue = Synchronization.queue(new PriorityQueue<PacketEventHolder>(), null); } this.maximumConcurrency = maximumConcurrency; this.concurrentProcessing = new Semaphore(maximumConcurrency); this.sendingHandler = sendingHandler; }
From source file:com.google.security.zynamics.reil.algorithms.mono2.common.MonoReilSolver.java
public MonoReilSolver(final IInstructionGraph instructionGraph, final AnalysisDirection analysisDirection, final ILattice<LatticeElementType> lattice) { m_graph = Preconditions.checkNotNull(instructionGraph, "Error: instruction graph argument can not be null"); m_direction = Preconditions.checkNotNull(analysisDirection, "Error: analysis direction argument can not be null"); m_lattice = Preconditions.checkNotNull(lattice, "Error: latice argument can not be null"); m_workList = MinMaxPriorityQueue.expectedSize(m_graph.size()).create(); }