public class MulticastReceiverImpl extends Object implements MulticastReceiver<MulticastReceiverConfigurationImpl>
MulticastSocket
.
Thread-safety is guaranteed through synchronization of methods of this service and by the thread-safe underlying socket.
Modifier and Type | Field and Description |
---|---|
protected MulticastReceiverConfigurationImpl |
configuration |
protected DatagramProcessor |
datagramProcessor |
protected InetSocketAddress |
multicastAddress |
protected NetworkInterface |
multicastInterface |
protected NetworkAddressFactory |
networkAddressFactory |
protected Router |
router |
protected MulticastSocket |
socket |
Constructor and Description |
---|
MulticastReceiverImpl(MulticastReceiverConfigurationImpl configuration) |
Modifier and Type | Method and Description |
---|---|
MulticastReceiverConfigurationImpl |
getConfiguration() |
void |
init(NetworkInterface networkInterface,
Router router,
NetworkAddressFactory networkAddressFactory,
DatagramProcessor datagramProcessor)
Configures the service and starts any listening sockets.
|
void |
run() |
void |
stop()
Stops the service, closes any listening sockets.
|
protected final MulticastReceiverConfigurationImpl configuration
protected Router router
protected NetworkAddressFactory networkAddressFactory
protected DatagramProcessor datagramProcessor
protected NetworkInterface multicastInterface
protected InetSocketAddress multicastAddress
protected MulticastSocket socket
public MulticastReceiverImpl(MulticastReceiverConfigurationImpl configuration)
public MulticastReceiverConfigurationImpl getConfiguration()
getConfiguration
in interface MulticastReceiver<MulticastReceiverConfigurationImpl>
public void init(NetworkInterface networkInterface, Router router, NetworkAddressFactory networkAddressFactory, DatagramProcessor datagramProcessor) throws InitializationException
MulticastReceiver
init
in interface MulticastReceiver<MulticastReceiverConfigurationImpl>
networkInterface
- The network interface on which to join the multicast group on.router
- The router which handles received IncomingDatagramMessage
s.networkAddressFactory
- The network address factory to use for local address lookup given a local interface and a remote address.datagramProcessor
- Reads and writes datagrams.InitializationException
- If the service could not be initialized or started.public void stop()
MulticastReceiver
stop
in interface MulticastReceiver<MulticastReceiverConfigurationImpl>
Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.