public interface BroadcastEndpoint
A BroadcastEndpoint can perform one of the two following tasks:
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.
JGroupsBroadcastEndpoint| Modifier and Type | Method and Description |
|---|---|
void |
broadcast(byte[] data)
Broadcasting data to the cluster.
|
void |
close(boolean isBroadcast)
Close the endpoint.
|
void |
openBroadcaster()
This method initializes a BroadcastEndpint as
a broadcaster.
|
void |
openClient()
This method initializes a BroadcastEndpoint as
a receiving end for broadcasts.
|
byte[] |
receiveBroadcast()
Receives the broadcast data.
|
byte[] |
receiveBroadcast(long time,
TimeUnit unit)
Receives the broadcast data with a timeout.
|
void openClient()
throws Exception
Exceptionvoid openBroadcaster()
throws Exception
Exceptionvoid close(boolean isBroadcast)
throws Exception
isBroadcast - : indicates whether this endpoint serves as a broadcast or not.Exceptionvoid broadcast(byte[] data)
throws Exception
data - : a byte array containing the data.Exceptionbyte[] receiveBroadcast()
throws Exception
Exceptionbyte[] receiveBroadcast(long time,
TimeUnit unit)
throws Exception
time - : how long the method should wait for the data to arrive.unit - : unit of the time.ExceptionCopyright © 2018 The Apache Software Foundation. All rights reserved.