code: public synchronized void flushAdaptee() throws IOException {
          OdsFlusher flusher = this.flushers.poll();
          if (flusher == null) return;
  
          while (flusher != null) {
              this.adaptee.update(flusher);
              if (flusher.isEnd()) {
                  this.stopped = true;
                  this.notifyAll(); // wakes up other threads: end of game
                  return;
              }
              flusher = this.flushers.poll();
          }
          try {
              this.wait();
          } catch (final InterruptedException e) {
              Thread.currentThread().interrupt();
              throw new RuntimeException(e);
          }
          this.notifyAll(); // wakes up other threads: no flusher left
      }
docs: Flushes all available flushers to the adaptee writer.
  The thread falls asleep if we reach the end of the queue without a FinalizeFlusher.
  
  @throws IOException if the adaptee throws an IOException