diff options
Diffstat (limited to 'src/main/java/derms/net/tomulticast/TotalOrderMulticastReceiver.java')
| -rw-r--r-- | src/main/java/derms/net/tomulticast/TotalOrderMulticastReceiver.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/derms/net/tomulticast/TotalOrderMulticastReceiver.java b/src/main/java/derms/net/tomulticast/TotalOrderMulticastReceiver.java index 549af16..bb0f2d8 100644 --- a/src/main/java/derms/net/tomulticast/TotalOrderMulticastReceiver.java +++ b/src/main/java/derms/net/tomulticast/TotalOrderMulticastReceiver.java @@ -6,6 +6,7 @@ import derms.util.ThreadPool; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.net.NetworkInterface; import java.time.Duration; import java.util.concurrent.*; import java.util.logging.Logger; @@ -24,6 +25,23 @@ public class TotalOrderMulticastReceiver<T extends MessagePayload> { * * @param group The IP address and port of the multicast group. * @param laddr The IP address of the local process. + * @param ifs The network interface to use. + */ + public TotalOrderMulticastReceiver(InetSocketAddress group, InetAddress laddr, NetworkInterface ifs) throws IOException { + this.deliver = new LinkedBlockingQueue<Message<T>>(); + this.log = Logger.getLogger(getClass().getName()); + + this.pool = Executors.newSingleThreadExecutor(); + this.receiver = new Receive<T>(group, laddr, deliver, ifs); + pool.execute(receiver); + } + + /** + * Join the specified totally-ordered multicast group as a receiver using the + * default network interface of the machine. + * + * @param group The IP address and port of the multicast group. + * @param laddr The IP address of the local process. */ public TotalOrderMulticastReceiver(InetSocketAddress group, InetAddress laddr) throws IOException { this.deliver = new LinkedBlockingQueue<Message<T>>(); |