GOSSIP-55 Added event handlers to notify share data and per node data changes
This commit is contained in:
committed by
Miraj Abeysekara
parent
9c9d96e564
commit
ade33a9e58
@ -79,10 +79,21 @@ public class StandAloneNodeCrdtOrSet {
|
||||
} else if (op == 'g') {
|
||||
gcount(val, gossipService);
|
||||
}
|
||||
if (op == 'l') {
|
||||
listen(val, gossipService);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void listen(String val, GossipManager gossipManager) {
|
||||
gossipManager.registerSharedDataSubscriber((key, oldValue, newValue) -> {
|
||||
if (key.equals(val)) {
|
||||
System.out.println("Event Handler fired! " + oldValue + " " + newValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void gcount(String val, GossipManager gossipManager) {
|
||||
GrowOnlyCounter c = (GrowOnlyCounter) gossipManager.findCrdt("def");
|
||||
Long l = Long.valueOf(val);
|
||||
|
Reference in New Issue
Block a user