dev@shoal.java.net

About supporting GMS's state listener

From: Bongjae Chang <carryel_at_korea.com>
Date: Sat, 20 Jun 2009 10:49:15 +0900

Hi,

Sometimes users would like to know whether join finished completely or not.

Like join, it is possible that users would like to know some events such as the gms leaves the group completely as well.

So if Shoal supports GMS's StateListener, I think that it can be useful.

Here is the simple sample.

---
public interface GroupManagementServiceStateListener {
   public void onStarted();
   public void onReady(); // or onJoined() or onMasterDiscovery()
   public void onStopped();
   public void onException(Throwable t);
   // etc...
}
---

A user implements own listeners according to his usecases and multiple listeners could exist.

And a user adds listeners to gms like this.

---
gms.addStateListener( userStateListener1 );
gms.addStateListener( userStateListener2 );
---

And a user use the listener.

---
gms.join();
// wait for onReady();
// when onReady() is notified, process gms operations
...
---

What do you think?

--
Bongjae Chang