Package org.jgroups.util
Class MyReceiver<T>
- java.lang.Object
-
- org.jgroups.util.MyReceiver<T>
-
-
Constructor Summary
Constructors Constructor Description MyReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
getState(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.String
name()
MyReceiver<T>
name(java.lang.String name)
MyReceiver<T>
rawMsgs(boolean flag)
void
receive(Message msg)
Called when a message is received.MyReceiver<T>
reset()
void
setState(java.io.InputStream input)
Allows an application to read the state from an InputStream.int
size()
java.util.Map<java.lang.String,java.lang.String>
state()
java.lang.String
toString()
MyReceiver<T>
verbose(boolean flag)
void
viewAccepted(View new_view)
Called when a change in membership has occurred.
-
-
-
Field Detail
-
lock
protected final java.util.concurrent.locks.Lock lock
-
list
protected final java.util.List<T> list
-
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:Receiver
Called when a message is received.
-
viewAccepted
public void viewAccepted(View new_view)
Description copied from interface:Receiver
Called 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:
viewAccepted
in interfaceReceiver
-
getState
public void getState(java.io.OutputStream out) throws java.lang.Exception
Description copied from interface:Receiver
Allows 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.Exception
Description copied from interface:Receiver
Allows 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)
-
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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-