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
Exception
void openBroadcaster() throws Exception
Exception
void close(boolean isBroadcast) throws Exception
isBroadcast
- : indicates whether this endpoint serves as a broadcast or not.Exception
void broadcast(byte[] data) throws Exception
data
- : a byte array containing the data.Exception
byte[] receiveBroadcast() throws Exception
Exception
byte[] receiveBroadcast(long time, TimeUnit unit) throws Exception
time
- : how long the method should wait for the data to arrive.unit
- : unit of the time.Exception
Copyright © 2020 JBoss by Red Hat. All rights reserved.