Search in sources :

Example 1 with RegisterListener

use of org.opendaylight.controller.cluster.example.messages.RegisterListener in project controller by opendaylight.

the class ExampleRoleChangeListener method handleReceive.

@Override
protected void handleReceive(Object message) throws Exception {
    if (message instanceof RegisterListener) {
        // called by the scheduler at intervals to register any unregistered notifiers
        sendRegistrationRequests();
    } else if (message instanceof RegisterRoleChangeListenerReply) {
        // called by the Notifier
        handleRegisterRoleChangeListenerReply(getSender().path().toString());
    } else if (message instanceof RoleChangeNotification) {
        // called by the Notifier
        RoleChangeNotification notification = (RoleChangeNotification) message;
        LOG.info("Role Change Notification received for member:{}, old role:{}, new role:{}", notification.getMemberId(), notification.getOldRole(), notification.getNewRole());
    // the apps dependent on such notifications can be called here
    // TODO: add implementation here
    }
}
Also used : RegisterRoleChangeListenerReply(org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListenerReply) RoleChangeNotification(org.opendaylight.controller.cluster.notifications.RoleChangeNotification) RegisterListener(org.opendaylight.controller.cluster.example.messages.RegisterListener)

Aggregations

RegisterListener (org.opendaylight.controller.cluster.example.messages.RegisterListener)1 RegisterRoleChangeListenerReply (org.opendaylight.controller.cluster.notifications.RegisterRoleChangeListenerReply)1 RoleChangeNotification (org.opendaylight.controller.cluster.notifications.RoleChangeNotification)1