We have had this requirement for having a single coordinator per cluster, and I have come up with a simple implementation. I am using a Hazlecast lock for this. The member who acquires this lock becomes the coordinator. In the event of the coordinator crashing, another member will acquire that lock, and will become the new coordinator. When a new member becomes the coordinator, then it may need to do certain things. For example, the tasks component may need to take over execution of tasks. In order to notify such components about this member becoming the coordinator, I have introduced an interface called CoordinatedActivity with a single method called execute. If you wish to be notified when this member becomes the coordinator, you need to register an OSGi service which implements that interface.
In addtion, the ClusteringAgent also has a method named isCoordinator and if your code wishes to check whether this member is the coordinator before executing certain things, you can call that method. The code is available in the feature branch https://github.com/wso2/carbon-kernel/tree/cluster-coordinator-feature -- *Afkham Azeez* Director of Architecture; WSO2, Inc.; http://wso2.com Member; Apache Software Foundation; http://www.apache.org/ * <http://www.apache.org/>* *email: **[email protected]* <[email protected]> * cell: +94 77 3320919 blog: **http://blog.afkham.org*<http://blog.afkham.org> *twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> * linked-in: **http://lk.linkedin.com/in/afkhamazeez <http://lk.linkedin.com/in/afkhamazeez>* *Lean . Enterprise . Middleware*
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
