Adding values to enum java.net.StandardProtocolFamily

David M. Lloyd david.lloyd at redhat.com
Thu Feb 13 06:23:17 PST 2014


On 02/13/2014 07:33 AM, Florian Weimer wrote:
> On 02/13/2014 02:21 PM, Alan Bateman wrote:
>> On 13/02/2014 12:54, Florian Weimer wrote:
>>> Can we add further enumeration values to
>>> java.net.StandardProtocolFamily?  The spec does not say so, unlike
>>> javax.lang.model.SourceVersion, and the code in the JDK expects a
>>> binary flag, so I think the answer is "no".
>>>
>>> Does this mean the expected way to add support for further protocol
>>> families would be to create a separate implementation of
>>> java.net.ProtocolFamily?
>
>> If there are protocol families that will be part of Java SE and
>> supported in all implementations then they could be added
>> StandardProtocolFamily. On the other hand, if this is platform or JDK
>> implementation specific then implementing ProtocolFamily is the way to
>> go (the enum extending interface pattern is something that we've used in
>> other areas too).
>
> Okay, sounds reasonable.  The PF_LOCAL protocol family is not available
> with Winsock, so I guess it will have to be a separate enum then, with a
> single member, although OpenJDK already requires PF_LOCAL support on the
> non-Windows platforms.

Windows "named pipes" seem similar enough to UNIX sockets for a uniform 
implementation (full-duplex, socket-like connection, byte- or 
message-oriented, reliable delivery, file-like API, to list a few things 
off of wikipedia).  It was my intent to support them in XNIO on Windows 
at some point, equivalently to UNIX sockets on other OSes, which I 
already have some support for.

For this reason it was always a pet peeve of mine that OpenJDK hasn't 
gone in for UNIX sockets.
-- 
- DML


More information about the net-dev mailing list