Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix wrong @author: tag which Java 9 JavaDoc chokes on
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
DataTreeChangeListenerActor.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerActor.java
b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerActor.java
index 2936a28b90a1f77cc640602c977751597fc8008b..e877a4d9e859ff5090e34807cb6ac33e7b76a461 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerActor.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerActor.java
@@
-12,7
+12,9
@@
import com.google.common.base.Preconditions;
import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
import org.opendaylight.controller.cluster.datastore.messages.DataTreeChangedReply;
import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
import org.opendaylight.controller.cluster.datastore.messages.DataTreeChanged;
import org.opendaylight.controller.cluster.datastore.messages.DataTreeChangedReply;
+import org.opendaylight.controller.cluster.datastore.messages.DataTreeListenerInfo;
import org.opendaylight.controller.cluster.datastore.messages.EnableNotification;
import org.opendaylight.controller.cluster.datastore.messages.EnableNotification;
+import org.opendaylight.controller.cluster.datastore.messages.GetInfo;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
@@
-24,6
+26,8
@@
final class DataTreeChangeListenerActor extends AbstractUntypedActor {
private final DOMDataTreeChangeListener listener;
private final YangInstanceIdentifier registeredPath;
private boolean notificationsEnabled = false;
private final DOMDataTreeChangeListener listener;
private final YangInstanceIdentifier registeredPath;
private boolean notificationsEnabled = false;
+ private long notificationCount;
+ private String logContext = "";
private DataTreeChangeListenerActor(final DOMDataTreeChangeListener listener,
final YangInstanceIdentifier registeredPath) {
private DataTreeChangeListenerActor(final DOMDataTreeChangeListener listener,
final YangInstanceIdentifier registeredPath) {
@@
-37,6
+41,9
@@
final class DataTreeChangeListenerActor extends AbstractUntypedActor {
dataChanged((DataTreeChanged)message);
} else if (message instanceof EnableNotification) {
enableNotification((EnableNotification) message);
dataChanged((DataTreeChanged)message);
} else if (message instanceof EnableNotification) {
enableNotification((EnableNotification) message);
+ } else if (message instanceof GetInfo) {
+ getSender().tell(new DataTreeListenerInfo(listener.toString(), registeredPath.toString(),
+ notificationsEnabled, notificationCount), getSelf());
} else {
unknownMessage(message);
}
} else {
unknownMessage(message);
}
@@
-46,16
+53,20
@@
final class DataTreeChangeListenerActor extends AbstractUntypedActor {
private void dataChanged(final DataTreeChanged message) {
// Do nothing if notifications are not enabled
if (!notificationsEnabled) {
private void dataChanged(final DataTreeChanged message) {
// Do nothing if notifications are not enabled
if (!notificationsEnabled) {
- LOG.debug("Notifications not enabled for listener {} - dropping change notification", listener);
+ LOG.debug("{}: Notifications not enabled for listener {} - dropping change notification",
+ logContext, listener);
return;
}
return;
}
- LOG.debug("Sending change notification {} to listener {}", message.getChanges(), listener);
+ LOG.debug("{}: Sending {} change notification(s) {} to listener {}", logContext, message.getChanges().size(),
+ message.getChanges(), listener);
+
+ notificationCount++;
try {
this.listener.onDataTreeChanged(message.getChanges());
} catch (Exception e) {
try {
this.listener.onDataTreeChanged(message.getChanges());
} catch (Exception e) {
- LOG.error("
Error notifying listener {}"
, this.listener, e);
+ LOG.error("
{}: Error notifying listener {}", logContext
, this.listener, e);
}
// TODO: do we really need this?
}
// TODO: do we really need this?
@@
-67,8
+78,9
@@
final class DataTreeChangeListenerActor extends AbstractUntypedActor {
}
private void enableNotification(final EnableNotification message) {
}
private void enableNotification(final EnableNotification message) {
+ logContext = message.getLogContext();
notificationsEnabled = message.isEnabled();
notificationsEnabled = message.isEnabled();
- LOG.debug("{}
notifications for listener {}"
, notificationsEnabled ? "Enabled" : "Disabled",
+ LOG.debug("{}
: {} notifications for listener {}", logContext
, notificationsEnabled ? "Enabled" : "Disabled",
listener);
}
listener);
}