src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
changeset 53419 eac105e3ec13
parent 51642 d4099c45f148
child 54154 1caf2daef7cf
child 57110 b848ca1ef778
equal deleted inserted replaced
53418:bc2bb4eee477 53419:eac105e3ec13
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    26 package sun.nio.ch;
    26 package sun.nio.ch;
    27 
    27 
    28 import java.io.FileDescriptor;
    28 import java.io.FileDescriptor;
    29 import java.io.IOException;
    29 import java.io.IOException;
    30 import java.net.InetSocketAddress;
    30 import java.net.InetSocketAddress;
    31 import java.net.ProtocolFamily;
       
    32 import java.net.ServerSocket;
    31 import java.net.ServerSocket;
    33 import java.net.SocketAddress;
    32 import java.net.SocketAddress;
    34 import java.net.SocketOption;
    33 import java.net.SocketOption;
    35 import java.net.StandardProtocolFamily;
       
    36 import java.net.StandardSocketOptions;
    34 import java.net.StandardSocketOptions;
    37 import java.nio.channels.AlreadyBoundException;
    35 import java.nio.channels.AlreadyBoundException;
    38 import java.nio.channels.AsynchronousCloseException;
    36 import java.nio.channels.AsynchronousCloseException;
    39 import java.nio.channels.ClosedChannelException;
    37 import java.nio.channels.ClosedChannelException;
    40 import java.nio.channels.NotYetBoundException;
    38 import java.nio.channels.NotYetBoundException;
    48 import java.util.Set;
    46 import java.util.Set;
    49 import java.util.concurrent.locks.ReentrantLock;
    47 import java.util.concurrent.locks.ReentrantLock;
    50 
    48 
    51 import sun.net.NetHooks;
    49 import sun.net.NetHooks;
    52 import sun.net.ext.ExtendedSocketOptions;
    50 import sun.net.ext.ExtendedSocketOptions;
    53 import static sun.net.ext.ExtendedSocketOptions.SOCK_STREAM;
       
    54 
    51 
    55 /**
    52 /**
    56  * An implementation of ServerSocketChannels
    53  * An implementation of ServerSocketChannels
    57  */
    54  */
    58 
    55 
   191             set.add(StandardSocketOptions.SO_RCVBUF);
   188             set.add(StandardSocketOptions.SO_RCVBUF);
   192             set.add(StandardSocketOptions.SO_REUSEADDR);
   189             set.add(StandardSocketOptions.SO_REUSEADDR);
   193             if (Net.isReusePortAvailable()) {
   190             if (Net.isReusePortAvailable()) {
   194                 set.add(StandardSocketOptions.SO_REUSEPORT);
   191                 set.add(StandardSocketOptions.SO_REUSEPORT);
   195             }
   192             }
   196             set.addAll(ExtendedSocketOptions.options(SOCK_STREAM));
   193             set.addAll(ExtendedSocketOptions.serverSocketOptions());
   197             return Collections.unmodifiableSet(set);
   194             return Collections.unmodifiableSet(set);
   198         }
   195         }
   199     }
   196     }
   200 
   197 
   201     @Override
   198     @Override