code: RunnablePair takeAndClear() {
      RunnablePair entries;
  
      while ((entries = callbacks.get()) != END) {
        if (callbacks.compareAndSet(entries, END)) {
          return entries;
        }
      }
  
      return null;
    }
docs: Take and reset all callbacks in an atomic fashion.