private ByteBuffer waitForData() throws InterruptedException {
      if (isClosed() || Thread.interrupted()) {
        throw new InterruptedException();
      }
      synchronized (dataMon) {
        ByteBuffer result = data;
        while (result == null) {
          if (isClosed() || Thread.interrupted()) {
            throw new InterruptedException();
          }
          // logit("about to dataMon wait");
          dataMon.wait(); // spurious wakeup ok
          // logit("after dataMon wait");
          if (isClosed() || Thread.interrupted()) {
            throw new InterruptedException();
          }
          result = data;
        }
        return result;
      }
    }
This input stream waits for data to be available. Once it is provided, by a call to addChunk,
it will stream the data in from that chunk, signal that is has completed, and then wait for
another chunk.
geode-core/src/main/java/org/apache/geode/internal/tcp/MsgDestreamer.java