01: // $Id: MessageListener.java,v 1.2 2005/07/17 11:38:05 chrislott Exp $
02:
03: package org.jgroups;
04:
05: /**
06: * Allows a listener to be notified when a message arrives.
07: * Contrary to the pull-style of channels, some building blocks
08: * (e.g., {@link org.jgroups.blocks.PullPushAdapter}) provide an
09: * event-like, push-style message delivery model.
10: * In this case, the entity to be notified of message reception needs to
11: * provide a callback to be invoked whenever a message has been received.
12: * The MessageListener interface provides a method to do so.
13: */
14: public interface MessageListener {
15: /**
16: * Called when a message is received.
17: * @param msg
18: */
19: void receive(Message msg);
20:
21: /**
22: * Answers the group state; e.g., when joining.
23: * @return byte[]
24: */
25: byte[] getState();
26:
27: /**
28: * Sets the group state; e.g., when joining.
29: * @param state
30: */
31: void setState(byte[] state);
32: }
|