Exemple #1
0
 /**
  * Special constructor used for RPC ownership transfer. Takes a snapshot slice of the current buf
  * but points directly to the underlying UnsafeLittleEndian buffer. Does this by calling unwrap()
  * twice on the provided DrillBuf and expecting an UnsafeDirectLittleEndian buffer. This operation
  * includes taking a new reference count on the underlying buffer and maintaining returning with a
  * current reference count for itself (masking the underlying reference count).
  *
  * @param allocator
  * @param a Allocator used when users try to receive allocator from buffer.
  * @param b Accountor used for accounting purposes.
  */
 public DrillBuf(BufferAllocator allocator, Accountor a, DrillBuf b) {
   this(allocator, a, getUnderlying(b), b, 0, b.length, true);
   assert b.unwrap().unwrap() instanceof UnsafeDirectLittleEndian;
   b.unwrap().unwrap().retain();
 }
Exemple #2
0
 private static ByteBuf getUnderlying(DrillBuf b) {
   ByteBuf underlying = b.unwrap().unwrap();
   return underlying.slice((int) (b.memoryAddress() - underlying.memoryAddress()), b.length);
 }