!act #15626 expose DatagramChannel creation in DatagramChannelCreator

* move channel creation logic to a separate trait
* new Java API: AbstractSocketOption
This commit is contained in:
Martynas Mickevicius 2014-08-19 14:02:23 +03:00
parent eb766d49f3
commit 325e05ee27
12 changed files with 466 additions and 6 deletions

View file

@ -83,3 +83,24 @@ the biggest difference is the absence of remote address information in
in the case of connection-based UDP the security check is cached after
connect, thus writes do not suffer an additional performance penalty.
UDP Multicast
------------------------------------------
If you want to use UDP multicast you will need to use Java 7. Akka provides
a way to control various options of ``DatagramChannel`` through the
``akka.io.Inet.SocketOption`` interface. The example below shows
how to setup a receiver of multicast messages using IPv6 protocol.
To select a Protocol Family you must extend ``akka.io.Inet.DatagramChannelCreator``
class which implements ``akka.io.Inet.SocketOption``. Provide custom logic
for opening a datagram channel by overriding :meth:`create` method.
.. includecode:: ../../../akka-samples/akka-docs-udp-multicast/src/main/java/docs/io/JavaUdpMulticast.java#inet6-protocol-family
Another socket option will be needed to join a multicast group.
.. includecode:: ../../../akka-samples/akka-docs-udp-multicast/src/main/java/docs/io/JavaUdpMulticast.java#multicast-group
Socket options must be provided to :meth:`UdpMessage.bind` command.
.. includecode:: ../../../akka-samples/akka-docs-udp-multicast/src/main/java/docs/io/JavaUdpMulticast.java#bind

View file

@ -51,9 +51,10 @@ Which turns out to be useful in many systems where same-state transitions actual
In case you do *not* want to trigger a state transition event when effectively performing an ``X->X`` transition, use ``stay()`` instead.
SocketOption's method signature changed to access channel
=========================================================
Server Socket Methods have been changed to take a channel instead of a socket. The channel's socket can be retrieved by calling ``channel.socket``. This allows for accessing new NIO features in Java 7.
More control over Channel properties in Akka-IO
===============================================
Method signatures for ``SocketOption`` have been changed to take a channel instead of a socket. The channel's socket
can be retrieved by calling ``channel.socket``. This allows for accessing new NIO features in Java 7.
======================================== =====================================
2.3 2.4
@ -66,6 +67,9 @@ Server Socket Methods have been changed to take a channel instead of a socket.
``afterConnect(Socket)`` ``afterConnect(SocketChannel)``
======================================== =====================================
A new class ``DatagramChannelCreator`` which extends ``SocketOption`` has been added. ``DatagramChannelCreator`` can be used for
custom ``DatagramChannel`` creation logic. This allows for opening IPv6 multicast datagram channels.
Removed Deprecated Features
===========================

View file

@ -83,4 +83,24 @@ the biggest difference is the absence of remote address information in
in the case of connection-based UDP the security check is cached after
connect, thus writes do not suffer an additional performance penalty.
UDP Multicast
------------------------------------------
If you want to use UDP multicast you will need to use Java 7. Akka provides
a way to control various options of ``DatagramChannel`` through the
``akka.io.Inet.SocketOption`` interface. The example below shows
how to setup a receiver of multicast messages using IPv6 protocol.
To select a Protocol Family you must extend ``akka.io.Inet.DatagramChannelCreator``
class which extends ``akka.io.Inet.SocketOption``. Provide custom logic
for opening a datagram channel by overriding :meth:`create` method.
.. includecode:: ../../../akka-samples/akka-docs-udp-multicast/src/main/scala/ScalaUdpMulticast.scala#inet6-protocol-family
Another socket option will be needed to join a multicast group.
.. includecode:: ../../../akka-samples/akka-docs-udp-multicast/src/main/scala/ScalaUdpMulticast.scala#multicast-group
Socket options must be provided to :class:`UdpMessage.Bind` message.
.. includecode:: ../../../akka-samples/akka-docs-udp-multicast/src/main/scala/ScalaUdpMulticast.scala#bind