Search in sources :

Example 1 with NotificationHandlerRegistry

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));
}
Also used : NotificationHandlerRegistry(org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry) BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) IBeanManager(org.eclipse.scout.rt.platform.IBeanManager) After(org.junit.After)

Example 2 with NotificationHandlerRegistry

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());
            }
        });
    }
}
Also used : NotificationHandlerRegistry(org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry) ServerRunContext(org.eclipse.scout.rt.server.context.ServerRunContext) IRunnable(org.eclipse.scout.rt.platform.util.concurrent.IRunnable)

Example 3 with NotificationHandlerRegistry

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);
}
Also used : NotificationHandlerRegistry(org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry)

Example 4 with NotificationHandlerRegistry

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));
}
Also used : NotificationHandlerRegistry(org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry) BeanMetaData(org.eclipse.scout.rt.platform.BeanMetaData) IBeanManager(org.eclipse.scout.rt.platform.IBeanManager) Before(org.junit.Before)

Aggregations

NotificationHandlerRegistry (org.eclipse.scout.rt.shared.notification.NotificationHandlerRegistry)4 BeanMetaData (org.eclipse.scout.rt.platform.BeanMetaData)2 IBeanManager (org.eclipse.scout.rt.platform.IBeanManager)2 IRunnable (org.eclipse.scout.rt.platform.util.concurrent.IRunnable)1 ServerRunContext (org.eclipse.scout.rt.server.context.ServerRunContext)1 After (org.junit.After)1 Before (org.junit.Before)1