From Alan.Bateman at Sun.COM Sat May 2 04:14:32 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Sat, 02 May 2009 12:14:32 +0100 Subject: Selector API [was Re: Java API for SCTP] In-Reply-To: <49F9F5D0.1070004@petit-huguenin.org> References: <514a207b0810311357u7f81ff9es24b1c842be5025e3@mail.gmail.com> <490C3195.1020909@sun.com> <49F9EA76.6070404@petit-huguenin.org> <49F9F267.5040109@sun.com> <49F9F5D0.1070004@petit-huguenin.org> Message-ID: <49FC2B18.1000606@sun.com> Marc Petit-Huguenin wrote: > I am evaluating the difficulties in implementing a DCCP channel that > can register on a selector also used by SCTP, UDP and/or TCP channels. > I'm not familiar with how the socket API is used for DCCP. Would the usage be closer to Server/SocketChannel than DatagramChannel (although you are sending datagrams rather than a stream)? Another potential way to integrate is not to develop a new channel type but to use the existing APIs. A while back I prototyped changes that would allow the protocol be specified when creating the channel. Here that might be SocketChannel.open(Protocols.getByName("dccp")) and the protocol is then mapped to the domain and protocol. -Alan. From marc at petit-huguenin.org Sat May 2 08:29:33 2009 From: marc at petit-huguenin.org (Marc Petit-Huguenin) Date: Sat, 02 May 2009 08:29:33 -0700 Subject: Selector API [was Re: Java API for SCTP] In-Reply-To: <49FC2B18.1000606@sun.com> References: <514a207b0810311357u7f81ff9es24b1c842be5025e3@mail.gmail.com> <490C3195.1020909@sun.com> <49F9EA76.6070404@petit-huguenin.org> <49F9F267.5040109@sun.com> <49F9F5D0.1070004@petit-huguenin.org> <49FC2B18.1000606@sun.com> Message-ID: <49FC66DD.5020204@petit-huguenin.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alan Bateman wrote: > Marc Petit-Huguenin wrote: >> I am evaluating the difficulties in implementing a DCCP channel that >> can register on a selector also used by SCTP, UDP and/or TCP channels. >> > I'm not familiar with how the socket API is used for DCCP. Would the > usage be closer to Server/SocketChannel than DatagramChannel (although > you are sending datagrams rather than a stream)? DCCP would be closer to ServerChannel/SocketServerChannel as DCCP sockets use the same connect/accept mechanism. But after this it would be closer to DatagramChannel for sending/receiving. > Another potential way > to integrate is not to develop a new channel type but to use the > existing APIs. A while back I prototyped changes that would allow the > protocol be specified when creating the channel. Here that might be > SocketChannel.open(Protocols.getByName("dccp")) and the protocol is then > mapped to the domain and protocol. > > -Alan. > - -- Marc Petit-Huguenin Home: marc at petit-huguenin.org Work: petithug at acm.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkn8Zt0ACgkQ9RoMZyVa61c2mwCgkpbs+n3Fgrqfww0KN6KzqvCI 48kAoJdJOol4cBgAWIkJIyMU6j4svcz7 =eC5+ -----END PGP SIGNATURE----- From marc at petit-huguenin.org Sat May 2 08:44:40 2009 From: marc at petit-huguenin.org (Marc Petit-Huguenin) Date: Sat, 02 May 2009 08:44:40 -0700 Subject: FileChannel Message-ID: <49FC6A68.8000907@petit-huguenin.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Is there a reason why FileChannel does not extend AbstractSelectableChannel in JDK7? I think that it would make sense now that there is a AsynchronousFileChannel implementation. AFAIK the change would not break compatibility. Thanks. - -- Marc Petit-Huguenin Home: marc at petit-huguenin.org Work: petithug at acm.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkn8amgACgkQ9RoMZyVa61emdgCffu5q7MBfISeCiNprBRG8uTKj kxkAnRuaDWlAVFFoV6NzVVZoaM3s6rRy =sBR+ -----END PGP SIGNATURE----- From Alan.Bateman at Sun.COM Sun May 3 01:23:04 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Sun, 03 May 2009 09:23:04 +0100 Subject: Selector API [was Re: Java API for SCTP] In-Reply-To: <49FC66DD.5020204@petit-huguenin.org> References: <514a207b0810311357u7f81ff9es24b1c842be5025e3@mail.gmail.com> <490C3195.1020909@sun.com> <49F9EA76.6070404@petit-huguenin.org> <49F9F267.5040109@sun.com> <49F9F5D0.1070004@petit-huguenin.org> <49FC2B18.1000606@sun.com> <49FC66DD.5020204@petit-huguenin.org> Message-ID: <49FD5468.60407@sun.com> Marc Petit-Huguenin wrote: > : > DCCP would be closer to ServerChannel/SocketServerChannel as DCCP > sockets use the same connect/accept mechanism. But after this it > would be closer to DatagramChannel for sending/receiving. > If the channel is connected then the SocketChannel API might be okay because/O with a connected DatagramChannel is identical to I/O with a SocketChannel. -Alan. From Alan.Bateman at Sun.COM Sun May 3 01:33:57 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Sun, 03 May 2009 09:33:57 +0100 Subject: FileChannel In-Reply-To: <49FC6A68.8000907@petit-huguenin.org> References: <49FC6A68.8000907@petit-huguenin.org> Message-ID: <49FD56F5.4060104@sun.com> Marc Petit-Huguenin wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Is there a reason why FileChannel does not extend > AbstractSelectableChannel in JDK7? I think that it would make sense > now that there is a AsynchronousFileChannel implementation. > > AFAIK the change would not break compatibility. > > Thanks. > FileChannel is intentionally not a SelectableChannel. In many cases it doesn't make sense to try to multiplex I/O with files because they are always ready for reading and writing. On other platforms it just isn't feasible because file I/O cannot be multiplexed. A future complication is that selectable channels are tied to a selector provider and so can be replaced independently of the file system provider. In jdk7, the file system provider is the factory for both FileChannels and AsynchronousFileChannels. -Alan.