|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mule.context.notification.ServerNotificationManager
public class ServerNotificationManager
A reworking of the event manager that allows efficient behaviour without global on/off switches in the config.
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:
Field Summary | |
---|---|
protected Log |
logger
|
static String |
NULL_SUBSCRIPTION
|
Fields inherited from interface org.mule.api.lifecycle.Disposable |
---|
PHASE_NAME |
Constructor Summary | |
---|---|
ServerNotificationManager()
|
Method Summary | |
---|---|
void |
addInterfaceToType(Class iface,
Class event)
|
void |
addListener(ServerNotificationListener listener)
|
void |
addListenerSubscription(ServerNotificationListener listener,
String subscription)
|
void |
addListenerSubscriptionPair(ListenerSubscriptionPair pair)
|
void |
disableInterface(Class iface)
|
void |
disableType(Class type)
|
void |
dispose()
A lifecycle method where implementor should free up any resources. |
void |
fireNotification(ServerNotification notification)
|
Map |
getInterfaceToTypes()
|
Collection |
getListeners()
|
boolean |
isNotificationDynamic()
|
boolean |
isNotificationEnabled(Class type)
This returns a very "conservative" value - it is true if the notification or any subclass would be accepted. |
protected void |
notifyListeners(ServerNotification notification)
|
void |
release()
|
void |
removeAllListeners(Collection listeners)
|
void |
removeListener(ServerNotificationListener listener)
This removes *all* registrations that reference this listener |
void |
run()
|
void |
setAllListenerSubscriptionPairs(Collection pairs)
|
void |
setDisabledInterfaces(Collection interfaces)
|
void |
setDisabledTypes(Collection types)
|
void |
setInterfaceToTypes(Map interfaceToEvents)
|
void |
setNotificationDynamic(boolean dynamic)
|
void |
start(WorkManager workManager,
javax.resource.spi.work.WorkListener workListener)
|
static Class |
toClass(Object value)
Support string or class parameters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String NULL_SUBSCRIPTION
protected Log logger
Constructor Detail |
---|
public ServerNotificationManager()
Method Detail |
---|
public boolean isNotificationDynamic()
isNotificationDynamic
in interface ServerNotificationHandler
public void setNotificationDynamic(boolean dynamic)
public void start(WorkManager workManager, javax.resource.spi.work.WorkListener workListener) throws LifecycleException
LifecycleException
public void addInterfaceToType(Class iface, Class event)
public void setInterfaceToTypes(Map interfaceToEvents) throws ClassNotFoundException
ClassNotFoundException
public void addListenerSubscriptionPair(ListenerSubscriptionPair pair)
public void addListener(ServerNotificationListener listener)
public void addListenerSubscription(ServerNotificationListener listener, String subscription)
public void setAllListenerSubscriptionPairs(Collection pairs)
public void removeListener(ServerNotificationListener listener)
public void removeAllListeners(Collection listeners)
public void disableInterface(Class iface) throws ClassNotFoundException
ClassNotFoundException
public void setDisabledInterfaces(Collection interfaces) throws ClassNotFoundException
ClassNotFoundException
public void disableType(Class type) throws ClassNotFoundException
ClassNotFoundException
public void setDisabledTypes(Collection types) throws ClassNotFoundException
ClassNotFoundException
public void fireNotification(ServerNotification notification)
fireNotification
in interface ServerNotificationHandler
public boolean isNotificationEnabled(Class type)
ServerNotificationHandler
isNotificationEnabled
in interface ServerNotificationHandler
type
- Either the notification class being generated or some superclass
public void dispose()
Disposable
dispose
in interface Disposable
protected void notifyListeners(ServerNotification notification)
public void release()
release
in interface javax.resource.spi.work.Work
public void run()
run
in interface Runnable
public static Class toClass(Object value) throws ClassNotFoundException
ClassNotFoundException
public Map getInterfaceToTypes()
public Collection getListeners()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |