/** * Add a random amount of random data to the target buffer. * * @param target the target buffer * @param random the RNG */ public static void addRandom(ByteBuffer target, Random random) { if (target.remaining() == 0) { return; } addRandom(target, random, random.nextInt(target.remaining())); }
/** * Add {@code count} bytes of random data to the target buffer using the thread-local RNG. * * @param target the target buffer * @param count the number of bytes to add */ public static void addRandom(ByteBuffer target, int count) { addRandom(target, IoUtils.getThreadLocalRandom(), count); }
/** * Add a random amount of random data to the target buffer using the thread-local RNG. * * @param target the target buffer */ public static void addRandom(ByteBuffer target) { addRandom(target, IoUtils.getThreadLocalRandom()); }
void sendAliveResponse() { Messages.conn.trace("Sending connection alive ack"); final Pooled<ByteBuffer> pooled = allocate(); boolean ok = false; try { final ByteBuffer buffer = pooled.getResource(); buffer.put(Protocol.CONNECTION_ALIVE_ACK); buffer.limit(80); Buffers.addRandom(buffer); buffer.flip(); send(pooled); ok = true; } finally { if (! ok) pooled.free(); } }
void sendAlive() { Messages.conn.trace("Sending connection alive"); final Pooled<ByteBuffer> pooled = allocate(); boolean ok = false; try { final ByteBuffer buffer = pooled.getResource(); buffer.put(Protocol.CONNECTION_ALIVE); buffer.limit(80); Buffers.addRandom(buffer); buffer.flip(); send(pooled); ok = true; messageReader.wakeupReads(); } finally { if (! ok) pooled.free(); } }
/** * Add a random amount of random data to the target buffer. * * @param target the target buffer * @param random the RNG */ public static void addRandom(ByteBuffer target, Random random) { if (target.remaining() == 0) { return; } addRandom(target, random, random.nextInt(target.remaining())); }
/** * Add a random amount of random data to the target buffer using the thread-local RNG. * * @param target the target buffer */ public static void addRandom(ByteBuffer target) { addRandom(target, IoUtils.getThreadLocalRandom()); }
/** * Add {@code count} bytes of random data to the target buffer using the thread-local RNG. * * @param target the target buffer * @param count the number of bytes to add */ public static void addRandom(ByteBuffer target, int count) { addRandom(target, IoUtils.getThreadLocalRandom(), count); }
void sendAliveResponse() { RemoteLogger.conn.trace("Sending connection alive ack"); final Pooled<ByteBuffer> pooled = allocate(); boolean ok = false; try { final ByteBuffer buffer = pooled.getResource(); buffer.put(Protocol.CONNECTION_ALIVE_ACK); buffer.limit(80); Buffers.addRandom(buffer); buffer.flip(); send(pooled); ok = true; } finally { if (! ok) pooled.free(); } }
void sendAliveResponse() { Messages.conn.trace("Sending connection alive ack"); final Pooled<ByteBuffer> pooled = allocate(); boolean ok = false; try { final ByteBuffer buffer = pooled.getResource(); buffer.put(Protocol.CONNECTION_ALIVE_ACK); buffer.limit(80); Buffers.addRandom(buffer); buffer.flip(); send(pooled); ok = true; } finally { if (! ok) pooled.free(); } }
void sendAlive() { RemoteLogger.conn.trace("Sending connection alive"); final Pooled<ByteBuffer> pooled = allocate(); boolean ok = false; try { final ByteBuffer buffer = pooled.getResource(); buffer.put(Protocol.CONNECTION_ALIVE); buffer.limit(80); Buffers.addRandom(buffer); buffer.flip(); send(pooled); ok = true; channel.wakeupReads(); } finally { if (! ok) pooled.free(); } }
void sendAlive() { Messages.conn.trace("Sending connection alive"); final Pooled<ByteBuffer> pooled = allocate(); boolean ok = false; try { final ByteBuffer buffer = pooled.getResource(); buffer.put(Protocol.CONNECTION_ALIVE); buffer.limit(80); Buffers.addRandom(buffer); buffer.flip(); send(pooled); ok = true; messageReader.wakeupReads(); } finally { if (! ok) pooled.free(); } }