I have a chat server that receives heartbeats from clients. The client passes inactive if the server didn't receive 3 consecutive heartbeats.
I have a chat groups, each group contains n members. If all members of a group become inactive, the group will be deleted.
In my opinion, I can use state and observer design patterns
State machine for members with states (active inactive) If the state become inactive the group will be updated/notified using observer design pattern.
What do you think? Any suggestions?
I have another question, how to declare the member inactive ?
My solution is to use a dedicated thread that compares the last received heartbeat for all members (1 thread for all members) The second solution is to create a thread per members that supervise that one.
Any comments?
Thanks
Aucun commentaire:
Enregistrer un commentaire