Class InvalidationEventHubImpl
- java.lang.Object
-
- org.apache.tapestry5.internal.event.InvalidationEventHubImpl
-
- All Implemented Interfaces:
InvalidationEventHub
- Direct Known Subclasses:
ComponentTemplateSourceImpl
,InternalComponentInvalidationEventHubImpl
,MessagesSourceImpl
,ResourceChangeTrackerImpl
public class InvalidationEventHubImpl extends java.lang.Object implements InvalidationEventHub
Base implementation class for classes (especially services) that need to manage a list ofInvalidationListener
s.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
InvalidationEventHubImpl(boolean productionMode, org.slf4j.Logger logger)
-
Method Summary
All Methods Instance Methods Concrete 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>> callback)
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)
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).void
clearOnInvalidation(java.util.Map<?,?> map)
Adds a callback that clears the map.protected void
fireInvalidationEvent()
Notifies all listeners/callbacks.void
fireInvalidationEvent(java.util.List<java.lang.String> resources)
Notifies all listeners/callbacks.
-
-
-
Constructor Detail
-
InvalidationEventHubImpl
protected InvalidationEventHubImpl(boolean productionMode, org.slf4j.Logger logger)
-
-
Method Detail
-
fireInvalidationEvent
protected final void fireInvalidationEvent()
Notifies all listeners/callbacks.
-
fireInvalidationEvent
public final void fireInvalidationEvent(java.util.List<java.lang.String> resources)
Notifies all listeners/callbacks.- Specified by:
fireInvalidationEvent
in interfaceInvalidationEventHub
-
addInvalidationCallback
public final void addInvalidationCallback(java.lang.Runnable callback)
Description copied from interface:InvalidationEventHub
Adds a callback that is invoked when an underlying tracked resource has changed. Does nothing in production mode.- Specified by:
addInvalidationCallback
in interfaceInvalidationEventHub
-
clearOnInvalidation
public final void clearOnInvalidation(java.util.Map<?,?> map)
Description copied from interface:InvalidationEventHub
Adds a callback that clears the map.- Specified by:
clearOnInvalidation
in interfaceInvalidationEventHub
-
addInvalidationListener
public final void addInvalidationListener(InvalidationListener listener)
Description copied from interface:InvalidationEventHub
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.- Specified by:
addInvalidationListener
in interfaceInvalidationEventHub
-
addInvalidationCallback
public void addInvalidationCallback(java.util.function.Function<java.util.List<java.lang.String>,java.util.List<java.lang.String>> callback)
Description copied from interface:InvalidationEventHub
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.- Specified by:
addInvalidationCallback
in interfaceInvalidationEventHub
-
-