/** * Creates a new {@link RecyclingByteBlockAllocator} with a block size of * {@link ByteBlockPool#BYTE_BLOCK_SIZE}, upper buffered docs limit of * {@link #DEFAULT_BUFFERED_BLOCKS} ({@value #DEFAULT_BUFFERED_BLOCKS}). * */ public RecyclingByteBlockAllocator() { this(ByteBlockPool.BYTE_BLOCK_SIZE, 64, Counter.newCounter(false)); }
/** * Creates a new {@link RecyclingByteBlockAllocator}. * * @param blockSize * the block size in bytes * @param maxBufferedBlocks * maximum number of buffered byte block */ public RecyclingByteBlockAllocator(int blockSize, int maxBufferedBlocks) { this(blockSize, maxBufferedBlocks, Counter.newCounter(false)); }
/** * Creates a new {@link RecyclingIntBlockAllocator}. * * @param blockSize * the size of each block returned by this allocator * @param maxBufferedBlocks * maximum number of buffered int blocks */ public RecyclingIntBlockAllocator(int blockSize, int maxBufferedBlocks) { this(blockSize, maxBufferedBlocks, Counter.newCounter(false)); }
/** * Creates a new {@link RecyclingIntBlockAllocator} with a block size of * {@link IntBlockPool#INT_BLOCK_SIZE}, upper buffered docs limit of * {@link #DEFAULT_BUFFERED_BLOCKS} ({@value #DEFAULT_BUFFERED_BLOCKS}). * */ public RecyclingIntBlockAllocator() { this(IntBlockPool.INT_BLOCK_SIZE, 64, Counter.newCounter(false)); }
/** * Returns a new counter. The returned counter is not thread-safe. */ public static Counter newCounter() { return newCounter(false); }
public DirectBytesStartArray(int initSize) { this(initSize, Counter.newCounter()); }
TermsHash(final DocumentsWriterPerThread docWriter, boolean trackAllocations, TermsHash nextTermsHash) { this.docState = docWriter.docState; this.trackAllocations = trackAllocations; this.nextTermsHash = nextTermsHash; this.bytesUsed = trackAllocations ? docWriter.bytesUsed : Counter.newCounter(); intPool = new IntBlockPool(docWriter.intBlockAllocator); bytePool = new ByteBlockPool(docWriter.byteBlockAllocator); if (nextTermsHash != null) { // We are primary termBytePool = bytePool; nextTermsHash.termBytePool = bytePool; } }
/** * Creates a new {@link BytesRefHash} */ public BytesRefHash(ByteBlockPool pool, int capacity, BytesStartArray bytesStartArray) { hashSize = capacity; hashHalfSize = hashSize >> 1; hashMask = hashSize - 1; this.pool = pool; ids = new int[hashSize]; Arrays.fill(ids, -1); this.bytesStartArray = bytesStartArray; bytesStart = bytesStartArray.init(); bytesUsed = bytesStartArray.bytesUsed() == null? Counter.newCounter() : bytesStartArray.bytesUsed(); bytesUsed.addAndGet(hashSize * Integer.BYTES); }
upto++; Counter counter = Counter.newCounter();
Counter bufferBytesUsed = Counter.newCounter(); buffer = new BytesRefArray(bufferBytesUsed); while (true) {
this.docState.similarity = indexWriterConfig.getSimilarity(); this.pendingNumDocs = pendingNumDocs; bytesUsed = Counter.newCounter(); byteBlockAllocator = new DirectTrackingAllocator(bytesUsed); pendingUpdates = new BufferedUpdates(segmentName);
/** * acquires the basis generation for a new snapshot. Any translog generation above, and including, the returned generation * will not be deleted until the returned {@link Releasable} is closed. */ synchronized Releasable acquireTranslogGen(final long translogGen) { translogRefCounts.computeIfAbsent(translogGen, l -> Counter.newCounter(false)).addAndGet(1); final AtomicBoolean closed = new AtomicBoolean(); assert assertAddTranslogRef(closed); return () -> { if (closed.compareAndSet(false, true)) { releaseTranslogGen(translogGen); assert assertRemoveTranslogRef(closed); } }; }
/** * Creates a new {@link RecyclingIntBlockAllocator} with a block size of * {@link IntBlockPool#INT_BLOCK_SIZE}, upper buffered docs limit of * {@link #DEFAULT_BUFFERED_BLOCKS} ({@value #DEFAULT_BUFFERED_BLOCKS}). * */ public RecyclingIntBlockAllocator() { this(IntBlockPool.INT_BLOCK_SIZE, 64, Counter.newCounter(false)); }
/** * Creates a new {@link RecyclingIntBlockAllocator} with a block size of * {@link IntBlockPool#INT_BLOCK_SIZE}, upper buffered docs limit of * {@link #DEFAULT_BUFFERED_BLOCKS} ({@value #DEFAULT_BUFFERED_BLOCKS}). * */ public RecyclingIntBlockAllocator() { this(IntBlockPool.INT_BLOCK_SIZE, 64, Counter.newCounter(false)); }
/** * Creates a new {@link RecyclingIntBlockAllocator}. * * @param blockSize * the size of each block returned by this allocator * @param maxBufferedBlocks * maximum number of buffered int blocks */ public RecyclingIntBlockAllocator(int blockSize, int maxBufferedBlocks) { this(blockSize, maxBufferedBlocks, Counter.newCounter(false)); }
/** * Creates a new {@link RecyclingByteBlockAllocator} with a block size of * {@link ByteBlockPool#BYTE_BLOCK_SIZE}, upper buffered docs limit of * {@link #DEFAULT_BUFFERED_BLOCKS} ({@value #DEFAULT_BUFFERED_BLOCKS}). * */ public RecyclingByteBlockAllocator() { this(ByteBlockPool.BYTE_BLOCK_SIZE, 64, Counter.newCounter(false)); }
/** * Creates a new {@link RecyclingIntBlockAllocator}. * * @param blockSize * the size of each block returned by this allocator * @param maxBufferedBlocks * maximum number of buffered int blocks */ public RecyclingIntBlockAllocator(int blockSize, int maxBufferedBlocks) { this(blockSize, maxBufferedBlocks, Counter.newCounter(false)); }
@Override public AccessibleTimeLimitingCollector newCollector() throws IOException { return new AccessibleTimeLimitingCollector( TopScoreDocCollector.create(perPage, lastEntry), Counter.newCounter(false), searchTimeoutMs ); }
public BytesRefTermsSet(final CircuitBreaker breaker) { super(breaker); this.bytesUsed = Counter.newCounter(); this.pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed)); this.set = new BytesRefHash(pool); }
@Override public void readFrom(StreamInput in) throws IOException { this.setIsPruned(in.readBoolean()); int size = in.readInt(); bytesUsed = Counter.newCounter(); pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed)); set = new BytesRefHash(pool); for (long i = 0; i < size; i++) { set.add(in.readBytesRef()); } }