Skip to content
Hellblazer edited this page Oct 26, 2012 · 9 revisions

The Gossip instance

The public protocol of Gossip instance

Starting and stopping the gossip service:

void start()
void terminate()

Querying

InetSocketAddress getLocalAddress()

State Replication

UUID register(byte[] state)
void update(UUID id, byte[] state)
void deregister(UUID id)

Setting the GossipListener

void setListener(GossipListener listener)

After construction of the Gossip instance, you must start() the service. Stopping the service is done by calling the terminate() method. You can find out the socket address used by the gossip protocol by calling the getLocalAddress() method.

State replication is controlled through the three state management methods. To register a new piece of replicated state, call the register() method. The UUID returned is the unique identity of this state and is used to maintain the state - so don't lose it.

To update state that has already been registered, call the update() method, supplying the id for this state. Deleting the state is done through the deregister() method, and you supply the id of the state you are deleting.

The GossipListener

To receive notifications about replicated state events, you supply an implementation of the GossipListener interface. This interface has three methods

register(UUID id, byte[] state)
update(UUID id, byte[] state)
deregister(UUID id)

The register() callback is invoked when new replicated state appears in the system, and the supplied UUID is the unique identity of that state within the set of nodes. When this state has been updated, the update() callback will be invoked with the identity of the updated state. When the state has been deleted from the system, the deregister() callback is invoked with the identity of the deleted state.

Clone this wiki locally