code: public void clearQueue() {
          try {
              mNotificationsLock.lock();
              while(!mNotifications.isEmpty()) {
                  mNotificationsChanged.await();
              }
          } catch(InterruptedException e) {
          } finally {
              mNotificationsLock.unlock();
          }
      }
docs: /* Block until the notifications queue is cleared.