jdk/src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
changeset 36115 0676e37a0b9c
parent 34774 03b4e6dc367b
equal deleted inserted replaced
36114:a5ed9456c9be 36115:0676e37a0b9c
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2016, 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
    31 import java.nio.channels.*;
    31 import java.nio.channels.*;
    32 import java.nio.channels.spi.*;
    32 import java.nio.channels.spi.*;
    33 import java.util.*;
    33 import java.util.*;
    34 import sun.net.NetHooks;
    34 import sun.net.NetHooks;
    35 
    35 
    36 
       
    37 /**
    36 /**
    38  * An implementation of ServerSocketChannels
    37  * An implementation of ServerSocketChannels
    39  */
    38  */
    40 
    39 
    41 class ServerSocketChannelImpl
    40 class ServerSocketChannelImpl
   183 
   182 
   184         private static Set<SocketOption<?>> defaultOptions() {
   183         private static Set<SocketOption<?>> defaultOptions() {
   185             HashSet<SocketOption<?>> set = new HashSet<>(2);
   184             HashSet<SocketOption<?>> set = new HashSet<>(2);
   186             set.add(StandardSocketOptions.SO_RCVBUF);
   185             set.add(StandardSocketOptions.SO_RCVBUF);
   187             set.add(StandardSocketOptions.SO_REUSEADDR);
   186             set.add(StandardSocketOptions.SO_REUSEADDR);
       
   187             if (Net.isReusePortAvailable()) {
       
   188                 set.add(StandardSocketOptions.SO_REUSEPORT);
       
   189             }
   188             set.add(StandardSocketOptions.IP_TOS);
   190             set.add(StandardSocketOptions.IP_TOS);
   189             return Collections.unmodifiableSet(set);
   191             return Collections.unmodifiableSet(set);
   190         }
   192         }
   191     }
   193     }
   192 
   194