Package org.rioproject.examples.events

Examples of org.rioproject.examples.events.HelloEvent


        try {
            /* Measure the time it takes to fire the event */
            watch.startTiming();
            String reply = "Hello visitor #"+(visitorNumber.getAndIncrement())+", " +
                           "your message was \""+message+"\"";
            eventHandler.fire(new HelloEvent(proxy, reply));
            notificationCount.incrementAndGet();
        } catch (NoEventConsumerException e) {
            logger.warn("No Event Consumers currently registered");
        } finally {
            watch.stopTiming();
View Full Code Here


     */
    class LocalEventConsumer implements RemoteServiceEventListener {
        public void notify(RemoteServiceEvent event) {
            if (event instanceof HelloEvent) {
                notificationCount++;
                HelloEvent helloEvent = (HelloEvent) event;
                /*
                * Instead of calling startTiming(), we use the time from the
                * event to set the start time. This will allow us to measure a
                * distributed response. Note: it is assumed the clocks are
                * roughly the same for this example.
                */
                watch.setStartTime(((HelloEvent) event).getWhen());
                watch.stopTiming();
                logger.info("Received HelloEvent seqno={}, message=[{}]",
                            event.getSequenceNumber(), helloEvent.getMessage());
            } else {
                logger.warn("Unwanted event received: {}", event);
            }
        }
View Full Code Here

TOP

Related Classes of org.rioproject.examples.events.HelloEvent

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.