public class NettyDatagramServer<IN,OUT> extends DatagramServer<IN,OUT>
DatagramServer implementation built on Netty.| Constructor and Description |
|---|
NettyDatagramServer(reactor.core.Environment env,
reactor.core.Reactor reactor,
java.net.InetSocketAddress listenAddress,
java.net.NetworkInterface multicastInterface,
ServerSocketOptions options,
reactor.io.encoding.Codec<reactor.io.Buffer,IN,OUT> codec,
java.util.Collection<reactor.function.Consumer<NetChannel<IN,OUT>>> consumers) |
| Modifier and Type | Method and Description |
|---|---|
protected <C> NetChannel<IN,OUT> |
createChannel(C ioChannel)
Subclasses should implement this method and provide a
NetChannel object. |
protected void |
doClose(reactor.function.Consumer<java.lang.Boolean> onClose)
Subclasses should implement this method to perform the actual IO channel close.
|
reactor.core.composable.Stream<IN> |
in()
Retrieve the
Stream on which can be composed actions to take when data comes into
this DatagramServer. |
reactor.core.composable.Promise<java.lang.Void> |
join(java.net.InetAddress multicastAddress,
java.net.NetworkInterface iface)
Join a multicast group.
|
reactor.core.composable.Promise<java.lang.Void> |
leave(java.net.InetAddress multicastAddress,
java.net.NetworkInterface iface)
Leave a multicast group.
|
reactor.function.batch.BatchConsumer<OUT> |
out()
Retrieve the
Stream into which data can accepted for sending to peers. |
DatagramServer<IN,OUT> |
send(OUT data)
Send data to peers.
|
reactor.core.composable.Promise<java.lang.Boolean> |
shutdown()
Shutdown this NetServer and complete the returned
Promise when shut
down. |
DatagramServer<IN,OUT> |
start(java.lang.Runnable started)
Start and bind this NetServer to the configured listen port and notify the given
Consumer when the bind operation is complete. |
getListenAddress, getMulticastInterface, getOptions, join, leave, startclose, close, close, doCloseChannel, getChannels, getCodec, getConsumers, getEnvironment, getReactor, iterator, notifyClose, notifyError, notifyOpen, notifyShutdown, notifyStart, register, selectpublic NettyDatagramServer(@Nonnull
reactor.core.Environment env,
@Nonnull
reactor.core.Reactor reactor,
@Nullable
java.net.InetSocketAddress listenAddress,
@Nullable
java.net.NetworkInterface multicastInterface,
@Nonnull
ServerSocketOptions options,
@Nullable
reactor.io.encoding.Codec<reactor.io.Buffer,IN,OUT> codec,
java.util.Collection<reactor.function.Consumer<NetChannel<IN,OUT>>> consumers)
public DatagramServer<IN,OUT> start(@Nullable java.lang.Runnable started)
NetServerConsumer when the bind operation is complete.public reactor.core.composable.Promise<java.lang.Boolean> shutdown()
NetServerPromise when shut
down.Promise that will be complete when the NetServer is shut downpublic DatagramServer<IN,OUT> send(OUT data)
DatagramServersend in class DatagramServer<IN,OUT>data - the data to sendpublic reactor.core.composable.Stream<IN> in()
DatagramServerStream on which can be composed actions to take when data comes into
this DatagramServer.in in class DatagramServer<IN,OUT>Streampublic reactor.function.batch.BatchConsumer<OUT> out()
DatagramServerStream into which data can accepted for sending to peers.out in class DatagramServer<IN,OUT>BatchConsumer for sending data outpublic reactor.core.composable.Promise<java.lang.Void> join(java.net.InetAddress multicastAddress,
java.net.NetworkInterface iface)
DatagramServerjoin in class DatagramServer<IN,OUT>multicastAddress - multicast address of the group to joiniface - interface to use for multicastpublic reactor.core.composable.Promise<java.lang.Void> leave(java.net.InetAddress multicastAddress,
java.net.NetworkInterface iface)
DatagramServerleave in class DatagramServer<IN,OUT>multicastAddress - multicast address of the group to leaveiface - interface to use for multicastprotected <C> NetChannel<IN,OUT> createChannel(C ioChannel)
AbstractNetPeerNetChannel object.createChannel in class AbstractNetPeer<IN,OUT>C - The type of the channel object.ioChannel - The IO channel object to associate with this NetChannel.NetChannel object.protected void doClose(@Nullable
reactor.function.Consumer<java.lang.Boolean> onClose)
AbstractNetPeerdoClose in class AbstractNetPeer<IN,OUT>