public class ServerNotificationManager extends Object implements javax.resource.spi.work.Work, 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:
Modifier and Type | Field and Description |
---|---|
protected Log |
logger |
static String |
NULL_SUBSCRIPTION |
PHASE_NAME
Constructor and Description |
---|
ServerNotificationManager() |
public static final String NULL_SUBSCRIPTION
protected Log logger
public boolean isNotificationDynamic()
isNotificationDynamic
in interface ServerNotificationHandler
public void setMuleContext(MuleContext context)
setMuleContext
in interface MuleContextAware
public void setNotificationDynamic(boolean dynamic)
public void start(WorkManager workManager, javax.resource.spi.work.WorkListener workListener) throws LifecycleException
LifecycleException
public void addInterfaceToType(Class<? extends ServerNotificationListener> iface, Class<? extends ServerNotification> event)
public void setInterfaceToTypes(Map<Class<? extends ServerNotificationListener>,Set<Class<? extends ServerNotification>>> interfaceToEvents) throws ClassNotFoundException
ClassNotFoundException
public void addListenerSubscriptionPair(ListenerSubscriptionPair pair)
public void addListener(ServerNotificationListener<?> listener)
public void addListenerSubscription(ServerNotificationListener<?> listener, String subscription)
@Deprecated public void addAllListenerSubscriptionPairs(Collection<?> pairs)
@Deprecated public void setAllListenerSubscriptionPairs(Collection<?> pairs)
pairs
- public void removeListener(ServerNotificationListener<?> listener)
@Deprecated public void removeAllListeners(Collection<ServerNotificationListener> listeners)
public void disableInterface(Class<? extends ServerNotificationListener> iface) throws ClassNotFoundException
ClassNotFoundException
public void setDisabledInterfaces(Collection<Class<? extends ServerNotificationListener>> interfaces) throws ClassNotFoundException
ClassNotFoundException
public void disableType(Class<? extends ServerNotification> type) throws ClassNotFoundException
ClassNotFoundException
@Deprecated public void setDisabledTypes(Collection<Class<? extends ServerNotificationListener>> types) throws ClassNotFoundException
ClassNotFoundException
public boolean isListenerRegistered(ServerNotificationListener listener)
isListenerRegistered
in interface ServerNotificationHandler
public void fireNotification(ServerNotification notification)
fireNotification
in interface ServerNotificationHandler
public boolean isNotificationEnabled(Class<? extends ServerNotification> type)
ServerNotificationHandler
isNotificationEnabled
in interface ServerNotificationHandler
type
- Either the notification class being generated or some superclasspublic void dispose()
Disposable
dispose
in interface Disposable
protected void notifyListeners(ServerNotification notification)
public void release()
release
in interface javax.resource.spi.work.Work
@Deprecated public Queue<ServerNotification> getEventQueue()
public Map<Class<? extends ServerNotificationListener>,Set<Class<? extends ServerNotification>>> getInterfaceToTypes()
public Set<ListenerSubscriptionPair> getListeners()
Copyright © 2003–2016 MuleSoft, Inc.. All rights reserved.