import org.opendaylight.controller.cluster.datastore.actors.DataTreeNotificationListenerRegistrationActor;
import org.opendaylight.controller.cluster.datastore.messages.EnableNotification;
import org.opendaylight.controller.cluster.datastore.messages.ListenerRegistrationMessage;
+import org.opendaylight.controller.cluster.datastore.messages.RegisterDataTreeNotificationListenerReply;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
void onLeadershipChange(boolean isLeader, boolean hasLeader) {
log.debug("{}: onLeadershipChange, isLeader: {}, hasLeader : {}", persistenceId(), isLeader, hasLeader);
- final EnableNotification msg = new EnableNotification(isLeader);
+ final EnableNotification msg = new EnableNotification(isLeader, persistenceId());
for (ActorSelection dataChangeListener : leaderOnlyListenerActors) {
dataChangeListener.tell(msg, getSelf());
}
@Override
void onMessage(M message, boolean isLeader, boolean hasLeader) {
- log.debug("{}: {} for {}, leader: {}", persistenceId(), logName(), message.getPath(), isLeader);
+ log.debug("{}: {} for {}, isLeader: {}, hasLeader: {}", persistenceId(), logName(), message,
+ isLeader, hasLeader);
ActorRef registrationActor = createActor(DataTreeNotificationListenerRegistrationActor.props());
log.debug("{}: {} sending reply, listenerRegistrationPath = {} ", persistenceId(), logName(),
registrationActor.path());
- tellSender(newRegistrationReplyMessage(registrationActor));
+ tellSender(new RegisterDataTreeNotificationListenerReply(registrationActor));
}
protected ActorSelection processListenerRegistrationMessage(M message) {
final ActorSelection listenerActor = selectActor(message.getListenerActorPath());
// We have a leader so enable the listener.
- listenerActor.tell(new EnableNotification(true), getSelf());
+ listenerActor.tell(new EnableNotification(true, persistenceId()), getSelf());
if (!message.isRegisterOnAllInstances()) {
// This is a leader-only registration so store a reference to the listener actor so it can be notified
abstract void doRegistration(M message, ActorRef registrationActor);
- protected abstract Object newRegistrationReplyMessage(ActorRef registrationActor);
-
protected abstract String logName();
}