Class RefreshListeners

    • Method Detail

      • forceRefreshes

        public Releasable forceRefreshes()
        Force-refreshes newly added listeners and forces a refresh if there are currently listeners registered. See refreshForcers.
      • addOrNotify

        public boolean addOrNotify​(Translog.Location location,
                                   Consumer<Boolean> listener)
        Add a listener for refreshes, calling it immediately if the location is already visible. If this runs out of listener slots then it forces a refresh and calls the listener immediately as well.
        Parameters:
        location - the location to listen for
        listener - for the refresh. Called with true if registering the listener ran it out of slots and forced a refresh. Called with false otherwise.
        Returns:
        did we call the listener (true) or register the listener to call later (false)?
      • refreshNeeded

        public boolean refreshNeeded()
        Returns true if there are pending listeners.
      • pendingCount

        public int pendingCount()
        The number of pending listeners.
      • setCurrentRefreshLocationSupplier

        public void setCurrentRefreshLocationSupplier​(Supplier<Translog.Location> currentRefreshLocationSupplier)
        Setup the translog used to find the last refreshed location.