Interface BroadcastEndpoint
- All Known Implementing Classes:
JGroupsBroadcastEndpoint, JGroupsChannelBroadcastEndpoint, JGroupsFileBroadcastEndpoint
public interface BroadcastEndpoint
BroadcastEndpint is used in BroadcastGroups and DiscoveryGroups for topology updates.
A BroadcastEndpoint can perform one of the two following tasks:
- when being used in BroadcastGroups, it broadcasts connector informations
- when being used in DiscoveryGroups, it receives broadcasts
The two tasks are mutual exclusive, meaning a BroadcastEndpoint can either be a broadcaster or a receiver, but not both.
It is an abstraction of various concrete broadcasting mechanisms. Different implementations of this interface may use different broadcasting techniques like UDP multicasting or JGroups channels.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidbroadcast(byte[] data) Broadcasting data to the cluster.voidclose(boolean isBroadcast) Close the endpoint.voidThis method initializes a BroadcastEndpint as a broadcaster.voidThis method initializes a BroadcastEndpoint as a receiving end for broadcasts.byte[]Receives the broadcast data.byte[]receiveBroadcast(long time, TimeUnit unit) Receives the broadcast data with a timeout.
-
Method Details
-
openClient
-
openBroadcaster
-
close
-
broadcast
-
receiveBroadcast
-
receiveBroadcast
Receives the broadcast data with a timeout. It blocks until either the data is available or the timeout is reached, whichever comes first.- Parameters:
time- : how long the method should wait for the data to arrive.unit- : unit of the time.- Returns:
- a byte array if data is arrived within the timeout, or null if no data is available after the timeout.
- Throws:
Exception
-