Package org.jgroups.util
Class MyReceiver<T>
- java.lang.Object
-
- org.jgroups.util.MyReceiver<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<T>listprotected java.util.concurrent.locks.Locklockprotected java.lang.Stringnameprotected booleanraw_msgsprotected java.util.Map<java.lang.String,java.lang.String>stateprotected booleanverboseprotected java.util.List<View>views
-
Constructor Summary
Constructors Constructor Description MyReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidgetState(java.io.OutputStream out)Allows an application to write the state to an OutputStream.java.util.List<T>list()java.util.List<java.lang.String>list(java.util.function.Function<T,java.lang.String> f)java.lang.Stringname()MyReceiver<T>name(java.lang.String name)MyReceiver<T>rawMsgs(boolean flag)voidreceive(Message msg)Called when a message is received.MyReceiver<T>reset()voidsetState(java.io.InputStream input)Allows an application to read the state from an InputStream.intsize()java.util.Map<java.lang.String,java.lang.String>state()java.lang.StringtoString()MyReceiver<T>verbose(boolean flag)voidviewAccepted(View new_view)Called when a change in membership has occurred.java.util.List<View>views()
-
-
-
Field Detail
-
lock
protected final java.util.concurrent.locks.Lock lock
-
list
protected final java.util.List<T> list
-
views
protected final java.util.List<View> views
-
name
protected java.lang.String name
-
verbose
protected boolean verbose
-
raw_msgs
protected boolean raw_msgs
-
state
protected final java.util.Map<java.lang.String,java.lang.String> state
-
-
Method Detail
-
receive
public void receive(Message msg)
Description copied from interface:ReceiverCalled when a message is received.
-
viewAccepted
public void viewAccepted(View new_view)
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 whenJChannel.connect(String)returns.- Specified by:
viewAcceptedin interfaceReceiver
-
getState
public void getState(java.io.OutputStream out) throws java.lang.ExceptionDescription 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
public void setState(java.io.InputStream input) throws java.lang.ExceptionDescription 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
public MyReceiver<T> rawMsgs(boolean flag)
-
list
public java.util.List<T> list()
-
list
public java.util.List<java.lang.String> list(java.util.function.Function<T,java.lang.String> f)
-
views
public java.util.List<View> views()
-
state
public java.util.Map<java.lang.String,java.lang.String> state()
-
verbose
public MyReceiver<T> verbose(boolean flag)
-
name
public java.lang.String name()
-
name
public MyReceiver<T> name(java.lang.String name)
-
reset
public MyReceiver<T> reset()
-
size
public int size()
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-