code: private void notifyHeartbeat() {
      ArrayList<NGHeartbeatListener> listeners;
      synchronized (heartbeatListeners) {
        if (heartbeatListeners.isEmpty()) {
          return;
        }
        // copy collection to avoid executing callbacks under lock
        listeners = new ArrayList<>(heartbeatListeners);
      }
  
      for (NGHeartbeatListener listener : listeners) {
        listener.heartbeatReceived();
      }
    }
docs: Calls heartbeatReceived method on all registered NGHeartbeatListeners.