Bug-2397:Provide a mechanism for stakeholders to get notifications on Raft state...
authorKamal Rameshan <kramesha@cisco.com>
Tue, 18 Nov 2014 23:26:51 +0000 (15:26 -0800)
committerKamal Rameshan <kramesha@cisco.com>
Wed, 26 Nov 2014 20:49:28 +0000 (20:49 +0000)
commit9418afa259fbbaa85ef7b22c854896afda5dc990
tree19894687d74810013dc676b14fa16cce108b378d
parent41368171b1098999f108d2f6271e07b6d6f8d52e
Bug-2397:Provide a mechanism for stakeholders to get notifications on Raft state change

A notifier actor is spawned from the RaftActor inherited implementation, in our case Shard or ExampleActor .

Its injected into the RaftActor.RaftActor notifies the notifier with the role changes. The Notification message is local to Shard or Example.

The idea is for any implementation to create a notifier, inject it and issue a notification from that notifier on a role change.

A sample example notifier, listener and notification is provided to show how a listener can register with the notifier and get notifications form the notifier.

Notifier and Notifications are assembled in commons, to be shared along with other apps who might need similar logic. It can be override by specific implementations.

Has been tested with the TestDriver, with separate actorsystems for listner and notifier

Tests have been added.

Change-Id: I23f16d4e76bb7dae640c544df282293274d9a1cb
Signed-off-by: Kamal Rameshan <kramesha@cisco.com>
java/org/opendaylight/controller/cluster/notifications/RegisterRoleChangeListener.java [new file with mode: 0644]
java/org/opendaylight/controller/cluster/notifications/RegisterRoleChangeListenerReply.java [new file with mode: 0644]
java/org/opendaylight/controller/cluster/notifications/RoleChangeNotification.java [new file with mode: 0644]
java/org/opendaylight/controller/cluster/notifications/RoleChangeNotifier.java [new file with mode: 0644]
java/org/opendaylight/controller/cluster/notifications/RoleChanged.java [new file with mode: 0644]