/** * Checks if queue node is being polled. * * @param qAddr Queue node address. * @return {@code True} if queue node is being polled. */ private boolean polling(long qAddr) { return mem.readByte(qAddr + 10) == 1; }
/** * Get value stored in offheap along with a value type. * * @param ptr Pointer to read. * @return Stored byte array and "raw bytes" flag. */ public IgniteBiTuple<byte[], Byte> get(long ptr) { assert ptr != 0; int size = readInt(ptr); byte type = readByte(ptr + 4); byte[] bytes = readBytes(ptr + 5, size); return new IgniteBiTuple<>(bytes, type); }
/** * @throws Exception If failed. */ @Test public void testByte() throws Exception { GridUnsafeMemory mem = new GridUnsafeMemory(64); int size = 32; long addr = mem.allocate(size); try { byte b1 = 123; mem.writeByte(addr, b1); byte b2 = mem.readByte(addr); assertEquals(b1, b2); byte b3 = 11; mem.writeByteVolatile(addr, b3); assertEquals(b3, mem.readByteVolatile(addr)); } finally { mem.release(addr, size); } }
/** * Get value stored in offheap along with a value type. * * @param ptr Pointer to read. * @return Stored byte array and "raw bytes" flag. */ public IgniteBiTuple<byte[], Byte> get(long ptr) { assert ptr != 0; int size = readInt(ptr); byte type = readByte(ptr + 4); byte[] bytes = readBytes(ptr + 5, size); return new IgniteBiTuple<>(bytes, type); }
/** {@inheritDoc} */ @Override public byte readByte() throws IOException { if (bufPosition >= bufLength) { currBufIdx++; switchCurrentBuffer(true); } return mem.readByte(currBuf + bufPosition++); }
/** {@inheritDoc} */ @Override public byte readByte() throws IOException { return mem.readByte(move(1)); }
/** * Checks if queue node is being polled. * * @param qAddr Queue node address. * @return {@code True} if queue node is being polled. */ private boolean polling(long qAddr) { return mem.readByte(qAddr + 10) == 1; }
/** {@inheritDoc} */ @Override public byte readByte() throws IOException { if (bufPosition >= bufLength) { currBufIdx++; switchCurrentBuffer(true); } return mem.readByte(currBuf + bufPosition++); }