code: public void stopWhenDone() {
          Thread t = new Thread(new Runnable() {
              @Override
              public void run() {
                  while (getCurrentRequests() > 0) {
                      try {
                          Thread.sleep(33);
                      } catch (InterruptedException e) {
                          e.printStackTrace();
                      }
                  }
              }
          });
          t.start();
  
          try {
              t.join();
          } catch (InterruptedException e) {
              e.printStackTrace();
          }
          stop();
      }
docs: Stops the queue when all requests are finished