Package akka.io
Class UdpManager
- java.lang.Object
-
- akka.io.SelectionHandler.SelectorBasedManager
-
- akka.io.UdpManager
-
- All Implemented Interfaces:
Actor
public class UdpManager extends SelectionHandler.SelectorBasedManager
INTERNAL APIUdpManager is a facade for simple fire-and-forget style UDP operations
UdpManager is obtainable by calling
(seeIO(Udp)
IO
andUdp
) *Warning!* Udp uses {@link java.nio.channels.DatagramChannel#send} to deliver datagrams, and as a consequence if a security manager has been installed then for each datagram it will verify if the target address and port number are permitted. If this performance overhead is undesirable use the connection style Udp extension. == Bind and send == To bind and listen to a local address, a {@link akka.io.Udp..Bind} command must be sent to this actor. If the binding was successful, the sender of the {@link akka.io.Udp.Bind} will be notified with a {@link akka.io.Udp.Bound} message. The sender of the {@link akka.io.Udp.Bound} message is the Listener actor (an internal actor responsible for listening to server events). To unbind the port an {@link akka.io.Tcp.Unbind} message must be sent to the Listener actor. If the bind request is rejected because the Udp system is not able to register more channels (see the nr-of-selectors and max-channels configuration options in the akka.io.udp section of the configuration) the sender will be notified with a {@link akka.io.Udp.CommandFailed} message. This message contains the original command for reference. The handler provided in the {@link akka.io.Udp.Bind} message will receive inbound datagrams to the bound port wrapped in {@link akka.io.Udp.Received} messages which contain the payload of the datagram and the sender address. UDP datagrams can be sent by sending {@link akka.io.Udp.Send} messages to the Listener actor. The sender port of the outbound datagram will be the port to which the Listener is bound. == Simple send == Udp provides a simple method of sending UDP datagrams if no reply is expected. To acquire the Sender actor a SimpleSend message has to be sent to the manager. The sender of the command will be notified by a SimpleSenderReady message that the service is available. UDP datagrams can be sent by sending {@link akka.io.Udp.Send} messages to the sender of SimpleSenderReady. All the datagrams will contain an ephemeral local port as sender and answers will be discarded.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
-
-
Constructor Summary
Constructors Constructor Description UdpManager(UdpExt udp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
receive()
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.-
Methods inherited from class akka.io.SelectionHandler.SelectorBasedManager
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, selectorPool, self, supervisorStrategy, workerForCommandHandler
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface akka.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, postStop, preRestart, preStart, sender, unhandled
-
-
-
-
Constructor Detail
-
UdpManager
public UdpManager(UdpExt udp)
-
-
Method Detail
-
receive
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Description copied from interface:Actor
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.- Returns:
- (undocumented)
-
-