org.jgroups
Interface MessageListener

All Known Subinterfaces:
Receiver
All Known Implementing Classes:
Chat, Draw, QuoteServer, ReceiverAdapter, RELAY.Receiver, RelayDemoRpc, Relayer.Bridge, ReplicatedHashMap, ReplicatedTree, ViewDemo, Whiteboard

public interface MessageListener

MessageListener allows a listener to be notified when a Message or a state transfer events arrives to a node.

MessageListener is often used by JGroups building blocks installed on top of a channel i.e RpcDispatcher and MessageDispatcher.

Since:
2.0
Author:
Bela Ban, Vladimir Blagojevic
See Also:
RpcDispatcher, MessageDispatcher

Method Summary
 void getState(java.io.OutputStream output)
          Allows an application to write a state through a provided OutputStream.
 void receive(Message msg)
          Called when a message is received.
 void setState(java.io.InputStream input)
          Allows an application to read a state through a provided InputStream.
 

Method Detail

receive

void receive(Message msg)
Called when a message is received.

Parameters:
msg -

getState

void getState(java.io.OutputStream output)
              throws java.lang.Exception
Allows an application to write a state through a provided OutputStream. After the state has been written the OutputStream doesn't need to be closed as stream closing is automatically done when a calling thread returns from this callback.

Parameters:
output - the OutputStream
Throws:
java.lang.Exception - if the streaming fails, any exceptions should be thrown so that the state requester can re-throw them and let the caller know what happened
See Also:
OutputStream.close()

setState

void setState(java.io.InputStream input)
              throws java.lang.Exception
Allows an application to read a state through a provided InputStream. After the state has been read the InputStream doesn't need to be closed as stream closing is automatically done when a calling thread returns from this callback.

Parameters:
input - the InputStream
Throws:
java.lang.Exception - if the streaming fails, any exceptions should be thrown so that the state requester can catch them and thus know what happened
See Also:
InputStream.close()


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.