blob: 0de0ad0ec2ce5579d98b3a4cde590c4fd8d5875e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package derms.net.tomulticast;
import derms.net.MessagePayload;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
/**
* The single sending process in a {@link TotalOrderMulticast} group. <b>Only one sender is
* allowed per group.</b>
*/
public class TotalOrderMulticastSender<T extends MessagePayload> extends TotalOrderMulticast<T> {
/**
* Join the specified totally-ordered multicast group as its lone sender.
*
* @param group The IP address and port of the multicast group to join.
* @param laddr The IP address of the local process.
*/
public TotalOrderMulticastSender(InetSocketAddress group, InetAddress laddr) throws IOException {
super(group, laddr);
}
/** Send a message to the group. */
public void send(T payload) throws IOException {
Message<T> msg = new Message<T>(seq, payload);
sock.send(msg);
incSeq();
log.info("Sent " + msg + " from " + sock + " to " + group);
}
}
|