Package org.rioproject.impl.event

Examples of org.rioproject.impl.event.DynamicEventConsumer


    public void registerForAllServiceNotification(RemoteServiceEventListener remoteEventListener,
                                                  DiscoveryManagement dMgr) throws Exception {
        /* Create the event consumer for ProvisionFailureEvent utilities */

        provisionFailureEventConsumer = new DynamicEventConsumer(ProvisionFailureEvent.getEventDescriptor(),
                                                                 remoteEventListener,
                                                                 dMgr);
        provisionMonitorEventConsumer = new DynamicEventConsumer(ProvisionMonitorEvent.getEventDescriptor(),
                                                                 remoteEventListener,
                                                                 dMgr);
        serviceLogEventConsumer = new DynamicEventConsumer(ServiceLogEvent.getEventDescriptor(),
                                                           remoteEventListener,
                                                           dMgr);
        slaThresholdEventConsumer = new DynamicEventConsumer(SLAThresholdEvent.getEventDescriptor(),
                                                             remoteEventListener,
                                                             dMgr);

    }
View Full Code Here


        Assert.assertNotNull(testManager);
        SLAThresholdEventProducer service =
            (SLAThresholdEventProducer)testManager.waitForService(SLAThresholdEventProducer.class);
        EventDescriptor eDesc = SLAThresholdEvent.getEventDescriptor();
        Assert.assertNotNull(service);
        DynamicEventConsumer eventConsumer = null;
        Throwable t = null;
        try {
            eventConsumer = new DynamicEventConsumer(eDesc,
                                                     testManager.getServiceDiscoveryManager().getDiscoveryManager());
        } catch (Exception e) {
            t = e;
            e.printStackTrace();
        }
        Assert.assertNull(t);
        Assert.assertNotNull(eventConsumer);
        Listener listener = new Listener();
        eventConsumer.register(listener);
        int waitCount = 0;
        while(!listener.upperBreachNotification() && waitCount<10) {
            try {
                service.increment();
                Thread.sleep(500);
                waitCount++;
            } catch (Exception e) {
                t = e;
                e.printStackTrace();
            }
        }
        Assert.assertNull(t);
        Assert.assertTrue(listener.upperBreachNotification());
        t = null;
        waitCount = 0;
        while(!listener.lowerBreachNotification() && waitCount<10) {
            try {
                service.decrement();
                Thread.sleep(500);
                waitCount++;
            } catch (Exception e) {
                t = e;
                e.printStackTrace();
            }
        }
        Assert.assertNull(t);
        Assert.assertTrue(listener.lowerBreachNotification());
        eventConsumer.terminate();
    }
View Full Code Here

TOP

Related Classes of org.rioproject.impl.event.DynamicEventConsumer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.