public class ServerNotificationManager extends Object implements org.mule.runtime.api.lifecycle.Initialisable, org.mule.runtime.api.lifecycle.Disposable, ServerNotificationHandler, MuleContextAware
The configuration and resulting policy are separate; the policy is a summary of the configuration that contains information to decide whether a particular message can be handled, and which updates that with experience gained handling messages. When the configuration is changed the policy is rebuilt. In this way we get a fairly efficient system without needing controls elsewhere.
However, measurements showed that there was still a small impact on speed in some cases. To improve behaviour further the
OptimisedNotificationHandler was added. This allows a service that generates
notifications to cache locally a handler optimised for a particular class.
The dynamic flag stops this caching from occurring. This reduces efficiency slightly (about 15% cost on simple VM messages, less on other transports)
Note that, because of subclass relationships, we need to be very careful about exactly what is enabled and disabled:
| Constructor and Description |
|---|
ServerNotificationManager() |
public boolean isNotificationDynamic()
isNotificationDynamic in interface ServerNotificationHandlerpublic void setMuleContext(MuleContext context)
setMuleContext in interface MuleContextAwarecontext - the Mule node.public void setNotificationDynamic(boolean dynamic)
public void initialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
initialise in interface org.mule.runtime.api.lifecycle.Initialisableorg.mule.runtime.api.lifecycle.InitialisationExceptionpublic void addInterfaceToType(Class<? extends ServerNotificationListener> iface, Class<? extends ServerNotification> event)
public void setInterfaceToTypes(Map<Class<? extends ServerNotificationListener>,Set<Class<? extends ServerNotification>>> interfaceToEvents) throws ClassNotFoundException
ClassNotFoundExceptionpublic void addListenerSubscriptionPair(ListenerSubscriptionPair pair)
public void addListener(ServerNotificationListener<?> listener)
public void addListenerSubscription(ServerNotificationListener<?> listener, String subscription)
public void removeListener(ServerNotificationListener<?> listener)
public void disableInterface(Class<? extends ServerNotificationListener> iface) throws ClassNotFoundException
ClassNotFoundExceptionpublic void setDisabledInterfaces(Collection<Class<? extends ServerNotificationListener>> interfaces) throws ClassNotFoundException
ClassNotFoundExceptionpublic void disableType(Class<? extends ServerNotification> type) throws ClassNotFoundException
ClassNotFoundExceptionpublic boolean isListenerRegistered(ServerNotificationListener listener)
isListenerRegistered in interface ServerNotificationHandlerpublic void fireNotification(ServerNotification notification)
fireNotification in interface ServerNotificationHandlerprotected void notifyListeners(ServerNotification notification, NotifierCallback notifier)
public boolean isNotificationEnabled(Class<? extends ServerNotification> type)
ServerNotificationHandlerisNotificationEnabled in interface ServerNotificationHandlertype - Either the notification class being generated or some superclasspublic void dispose()
dispose in interface org.mule.runtime.api.lifecycle.Disposablepublic Map<Class<? extends ServerNotificationListener>,Set<Class<? extends ServerNotification>>> getInterfaceToTypes()
public Set<ListenerSubscriptionPair> getListeners()
public boolean isDisposed()
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.