Package org.apache.tapestry5.commons.services

## Interface InvalidationEventHub

- All Known Subinterfaces:
    `InternalComponentInvalidationEventHub`, `MessagesSource`, `ResourceChangeTracker`, `ResourceDigestManager`
  All Known Implementing Classes:
    `ComponentTemplateSourceImpl`, `InternalComponentInvalidationEventHubImpl`, `InvalidationEventHubImpl`, `MessagesSourceImpl`, `ResourceChangeTrackerImpl`, `ResourceDigestManagerImpl`

      public interface InvalidationEventHub

  An object which manages a list of `InvalidationListener`s. There are multiple event hub services implementing this interface, each with a specific marker annotation; each can register listeners and fire events; these are based on the type of resource that has been invalidated. Tapestry has built-in support for:
  message catalog resources
    ComponentMessages marker annotation
  component templates
    ComponentTemplates marker annotation
  component classes
    ComponentClasses marker annotation
  Starting in Tapestry 5.3, these services are disabled in production (it does nothing).
  Since:
    5.1.0.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addInvalidationCallback​(java.lang.Runnable callback)` | Adds a callback that is invoked when an underlying tracked resource has changed.
    `void` | `addInvalidationCallback​(java.util.function.Function<java.util.List<java.lang.String>,​java.util.List<java.lang.String>> function)` | Adds a callback, as a function that receives a list of strings and also returns a list of strings, that is invoked when one or more listed underlying tracked resource have changed.
    `void` | `addInvalidationListener​(InvalidationListener listener)` | Deprecated. in 5.4, use `addInvalidationCallback(Runnable)` instead}
    `void` | `clearOnInvalidation​(java.util.Map<?,​?> map)` | Adds a callback that clears the map.
    `void` | `fireInvalidationEvent​(java.util.List<java.lang.String> resources)` | Notify resource-specific invalidations to listeners.

- - ### Method Detail

    - #### addInvalidationListener

          void addInvalidationListener​(InvalidationListener listener)

      Deprecated.
      in 5.4, use `addInvalidationCallback(Runnable)` instead}
      Adds a listener, who needs to know when an underlying resource of a given category has changed (so that the receiver may discard any cached data that may have been invalidated). Does nothing in production mode.

    - #### addInvalidationCallback

          void addInvalidationCallback​(java.lang.Runnable callback)

      Adds a callback that is invoked when an underlying tracked resource has changed. Does nothing in production mode.
      Since:
        5.4

    - #### clearOnInvalidation

          void clearOnInvalidation​(java.util.Map<?,​?> map)

      Adds a callback that clears the map.
      Since:
        5.4

    - #### addInvalidationCallback

          @IncompatibleChange(release="5.8.3",
                              details="Added method")
          void addInvalidationCallback​(java.util.function.Function<java.util.List<java.lang.String>,​java.util.List<java.lang.String>> function)

      Adds a callback, as a function that receives a list of strings and also returns a list of strings, that is invoked when one or more listed underlying tracked resource have changed. An empty list should be considered as all resources being changed and any caches needing to be cleared. The return value of the function should be a non-null, but possibly empty, list of other resources that also need to be invalidated in a recursive fashion. This method does nothing in production mode.
      Since:
        5.8.3

    - #### fireInvalidationEvent

          @IncompatibleChange(release="5.8.3",
                              details="Added method")
          void fireInvalidationEvent​(java.util.List<java.lang.String> resources)

      Notify resource-specific invalidations to listeners.
      Since:
        5.8.3