List of usage examples for org.apache.lucene.util ByteBlockPool ByteBlockPool
public ByteBlockPool(Allocator allocator)
From source file:solutions.siren.join.action.terms.collector.BytesRefTermsSet.java
License:Open Source License
public BytesRefTermsSet(final CircuitBreaker breaker) { super(breaker); this.bytesUsed = Counter.newCounter(); this.pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed)); this.set = new BytesRefHash(pool); }
From source file:solutions.siren.join.action.terms.collector.BytesRefTermsSet.java
License:Open Source License
@Override public void readFrom(StreamInput in) throws IOException { this.setIsPruned(in.readBoolean()); int size = in.readInt(); bytesUsed = Counter.newCounter();// ww w .j a va 2 s. com pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed)); set = new BytesRefHash(pool); for (long i = 0; i < size; i++) { set.add(in.readBytesRef()); } }
From source file:solutions.siren.join.action.terms.collector.BytesRefTermsSet.java
License:Open Source License
private void readFromBytes(BytesRef bytes) { // Read pruned flag this.setIsPruned(bytes.bytes[bytes.offset++] == 1 ? true : false); // Read size fo the set int size = Bytes.readInt(bytes); // Read terms bytesUsed = Counter.newCounter();/*from w w w . java2s . c o m*/ pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed)); set = new BytesRefHash(pool); BytesRef reusable = new BytesRef(); for (int i = 0; i < size; i++) { Bytes.readBytesRef(bytes, reusable); set.add(reusable); } }