Hi,
I need a cluster implementation of my listeners that use a sequential policy : when a listener method is invoked, other listener on the same cluster must wait the end of the current running listener method. Indeed, this listeners make update on database sometimes on the same tables (no transaction ).
AsynchronousCluster allows easily this behavior, but my problem is that this cluster must be also replayable, and replaying an asynchronous cluster causes some bugs because my listeners need to implement ReplayAware in order to make some actions only if the cluster is not in replaying mode. When i replay on asynchronous cluster, the methods beforeReplay() and afterReplay() are called successively, while replaying is still in progress.
If i use SimpleCluster to resolve replaying problem, i notice that this cluster does not manage the sequential policy : if an event are triggered by command in an other thread, multiple methods in the same listeners can be called in the same time.
What is the best solution ? I thought to write a SequentialSimpleCluster, which is the same implementation of SimpleCluster, but adding synchronize keyword to the method “doPublish”, but i’m not sure that is a good solution.
Thanks,
Baptiste.