Receives a message, a view change or a block event. By using
setOpt
, the type of objects to be received can be determined (e.g., not views and blocks, just messages). The possible types returned can be:
Message
. Normal message Event
. All other events (used by JChannel) View
. A view change. BlockEvent
. A block event indicating that a flush protocol has been started, and we should not send any more messages. This event should be ack'ed by calling {@link org.jgroups.Channel#blockOk()} .Any messages sent after blockOk() returns might get blocked until the flush protocol has completed. UnblockEvent
. An unblock event indicating that the flush protocol has completed and we can resume sending messages SuspectEvent
. A notification of a suspected member. GetStateEvent
. The current state of the application should be returned using ReturnState
. SetStateEvent
. The state of a single/all members as requested previously by having called Channel.getState(s). ExitEvent
. Signals that this member was forced to leave the group (e.g., caused by the member being suspected.) The member can rejoin the group by calling open(). If the AUTO_RECONNECT is set (see setOpt()), the reconnect will be done automatically.
The
instanceof
operator can be used to discriminate between different types returned.
@param timeout Value in milliseconds. Value <= 0 means wait forever
@return A Message, View, BlockEvent, SuspectEvent, GetStateEvent, SetStateEvent orExitEvent, depending on what is on top of the internal queue.
@exception ChannelNotConnectedException The channel must be connected to receive messages.
@exception ChannelClosedException The channel is closed and therefore cannot be used any longer.A new channel has to be created first.
@exception TimeoutException Thrown when a timeout has occurred.
@deprecated Use a {@link Receiver} instead