use of org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry in project scout.rt by eclipse.
the class NotificationDispatcherTest method after.
@After
public void after() {
TestingUtility.unregisterBeans(m_serviceReg);
// ensure bean hander cache of notification dispatcher gets refreshed
IBeanManager beanManager = BEANS.getBeanManager();
IBean<NotificationHandlerRegistry> bean = beanManager.getBean(NotificationHandlerRegistry.class);
beanManager.unregisterBean(bean);
beanManager.registerBean(new BeanMetaData(bean));
}
use of org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry in project scout.rt by eclipse.
the class ClusterSynchronizationService method onMessage.
@Override
public void onMessage(IMessage<IClusterNotificationMessage> message) {
final IClusterNotificationMessage notificationMessage = message.getTransferObject();
if (isEnabled()) {
// Do not progress notifications sent by node itself
String originNode = notificationMessage.getProperties().getOriginNode();
if (m_nodeId.equals(originNode)) {
return;
}
getStatusInfoInternal().updateReceiveStatus(notificationMessage);
getStatusInfoInternal(notificationMessage.getNotification().getClass()).updateReceiveStatus(notificationMessage);
ServerRunContext serverRunContext = ServerRunContexts.empty();
serverRunContext.withSubject(m_subject);
serverRunContext.withSession(BEANS.get(ServerSessionProviderWithCache.class).provide(serverRunContext.copy()));
serverRunContext.run(new IRunnable() {
@Override
public void run() throws Exception {
NotificationHandlerRegistry reg = BEANS.get(NotificationHandlerRegistry.class);
reg.notifyNotificationHandlers(notificationMessage.getNotification());
}
});
}
}
use of org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry in project scout.rt by eclipse.
the class ClientNotificationDispatcher method dispatchSync.
protected void dispatchSync(Serializable notification, IClientNotificationAddress address) {
NotificationHandlerRegistry reg = BEANS.get(NotificationHandlerRegistry.class);
reg.notifyHandlers(notification, address);
}
use of org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry in project scout.rt by eclipse.
the class NotificationDispatcherTest method before.
@Before
public void before() throws Exception {
m_globalNotificationHanlder = mock(GlobalNotificationHandler.class);
m_groupNotificationHanlder = mock(GroupNotificationHandler.class);
m_serviceReg = TestingUtility.registerBeans(new BeanMetaData(GlobalNotificationHandler.class).withInitialInstance(m_globalNotificationHanlder).withApplicationScoped(true), new BeanMetaData(GroupNotificationHandler.class).withInitialInstance(m_groupNotificationHanlder).withApplicationScoped(true));
// ensure bean hander cache of notification dispatcher gets refreshed
IBeanManager beanManager = BEANS.getBeanManager();
IBean<NotificationHandlerRegistry> bean = beanManager.getBean(NotificationHandlerRegistry.class);
beanManager.unregisterBean(bean);
beanManager.registerBean(new BeanMetaData(bean));
}
Aggregations