*/
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);
}
}