Package org.jgroups.util
Class MyReceiver<T>
java.lang.Object
org.jgroups.util.MyReceiver<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,Receiver
Generic receiver for a JChannel
- Since:
- 3.3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidgetState(OutputStream out) Allows an application to write the state to an OutputStream.list()name()rawMsgs(boolean flag) voidCalled when a message is received.reset()voidsetState(InputStream input) Allows an application to read the state from an InputStream.intsize()state()toString()verbose(boolean flag) voidviewAccepted(View new_view) Called when a change in membership has occurred.
-
Field Details
-
list
-
name
-
verbose
protected boolean verbose -
raw_msgs
protected boolean raw_msgs -
state
-
-
Constructor Details
-
MyReceiver
public MyReceiver()
-
-
Method Details
-
receive
Description copied from interface:ReceiverCalled when a message is received. -
viewAccepted
Description copied from interface:ReceiverCalled when a change in membership has occurred. No long running actions, sending of messages or anything that could block should be done in this callback. If some long running action needs to be performed, it should be done in a separate thread.Note that on reception of the first view (a new member just joined), the channel will not yet be in the connected state. This only happens when
JChannel.connect(String)returns.- Specified by:
viewAcceptedin interfaceReceiver
-
getState
Description copied from interface:ReceiverAllows an application to write the state to an 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. -
setState
Description copied from interface:ReceiverAllows an application to read the state from an 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. -
rawMsgs
-
list
-
list
-
state
-
verbose
-
name
-
name
-
reset
-
size
public int size() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
toString
-