private ByteBuffer waitForNextDataToWrite() throws InterruptedException {
        ByteBuffer dataToWriteToFile;

        dataToWriteToFile =
                inputChannel.poll(FORCE_FLUSH_AFTER_THIS_MANY_MILI_SECONDS,
                        TimeUnit.MILLISECONDS);

        return dataToWriteToFile;
    }
private ByteBuffer waitForNextDataToWrite() throws InterruptedException {
        ByteBuffer dataToWriteToFile;

        dataToWriteToFile =
                inputChannel.poll(FORCE_FLUSH_AFTER_THIS_MANY_MILI_SECONDS,
                        TimeUnit.MILLISECONDS);

        return dataToWriteToFile;
    }
private ByteBuffer waitForNextDataToWrite ( ) throws InterruptedException { ByteBuffer dataToWriteToFile ; dataToWriteToFile = inputChannel . poll ( FORCE_FLUSH_AFTER_THIS_MANY_MILI_SECONDS , TimeUnit . MILLISECONDS ) ; return dataToWriteToFile ; }
If we don't have any data, and we have flushed,
then we can wait on the outputDataQueue. There is no sense spin-locking.
The poll(time, timeunit) call will block until there is something to do
or until the timeout.

@return the next byte buffer.
@throws InterruptedException
If we don t have any data and we have flushed then we can wait on the outputDataQueue . There is no sense spin - locking . The poll ( time timeunit ) call will block until there is something to do or until the timeout .