Here you can find the source of retryRead(ReadableByteChannel channel, ByteBuffer buffer)
static int retryRead(ReadableByteChannel channel, ByteBuffer buffer) throws IOException
//package com.java2s; // This software, the RabbitMQ Java client library, is triple-licensed under the import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.ReadableByteChannel; public class Main { static int retryRead(ReadableByteChannel channel, ByteBuffer buffer) throws IOException { int attempt = 0; int read = 0; while (attempt < 3) { try { Thread.sleep(100L); } catch (InterruptedException e) { // ignore }/*ww w . ja va 2 s . c o m*/ read = read(channel, buffer); if (read > 0) { break; } attempt++; } return read; } static int read(ReadableByteChannel channel, ByteBuffer buffer) throws IOException { int read = channel.read(buffer); if (read < 0) { throw new IOException("I/O thread: reached EOF"); } return read; } }