code: public final void doWrites() {
          QueuedMediaData[] slice = null;
          writeLock.lock();
          try {
              slice = queue.toArray(new QueuedMediaData[0]);
              if (queue.removeAll(Arrays.asList(slice))) {
                  log.debug("Queued writes transfered, count: {}", slice.length);
              }
          } finally {
              writeLock.unlock();
          }
          // sort
          Arrays.sort(slice);
          // write
          doWrites(slice);
      }
docs: Write all the queued items to the writer.