!act #13490 Changed the callback to SocketOption to accept a channel instead of a Socket, this allows for using the nio features.
For example in Java 7 you can now join a multicast group:
case class JoinGroup(group: InetAddress, networkInterface: NetworkInterface) extends SocketOption {
override def afterConnect(c: DatagramChannel): Unit = {
c.join(group, networkInterface)
}
}
IO(Udp) ! Udp.Bind(self, new InetSocketAddress(MulticastListener.port),
options=List(ReuseAddress(true),
JoinGroup(MulticastListener.group, MulticastListener.interf)))
Other minor changes:
- changed all methods in SocketOption to take a Channel instead of a Socket. The socket can be gotten from the Channel but not the reverse.
- all methods that are called before the bind are now called beforeBind for consistency.
- All network connections now call the beforeBind and afterConnect.
This commit is contained in:
parent
cb05725c1e
commit
a6d3704ef6
11 changed files with 104 additions and 30 deletions
|
|
@ -51,6 +51,21 @@ 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.
|
||||
|
||||
======================================== =====================================
|
||||
2.3 2.4
|
||||
======================================== =====================================
|
||||
``beforeDatagramBind(DatagramSocket)`` ``beforeBind(DatagramChannel)``
|
||||
``beforeServerSocketBind(ServerSocket)`` ``beforeBind(ServerSocketChannel)``
|
||||
``beforeConnect(Socket)`` ``beforeBind(SocketChannel)``
|
||||
\ ``afterConnect(DatagramChannel)``
|
||||
\ ``afterConnect(ServerSocketChannel)``
|
||||
``afterConnect(Socket)`` ``afterConnect(SocketChannel)``
|
||||
======================================== =====================================
|
||||
|
||||
Removed Deprecated Features
|
||||
===========================
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue