src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousServerSocketChannelImpl.java

Print this page
rev 12972 : 8140606: Update library code to use internal Unsafe
Reviewed-by: duke


  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.ch;
  27 
  28 import java.nio.channels.*;
  29 import java.net.InetSocketAddress;
  30 import java.util.concurrent.Future;
  31 import java.util.concurrent.atomic.AtomicBoolean;
  32 import java.io.IOException;
  33 import java.security.AccessControlContext;
  34 import java.security.AccessController;
  35 import java.security.PrivilegedAction;
  36 import sun.misc.Unsafe;
  37 
  38 /**
  39  * Windows implementation of AsynchronousServerSocketChannel using overlapped I/O.
  40  */
  41 
  42 class WindowsAsynchronousServerSocketChannelImpl
  43     extends AsynchronousServerSocketChannelImpl implements Iocp.OverlappedChannel
  44 {
  45     private static final Unsafe unsafe = Unsafe.getUnsafe();
  46 
  47     // 2 * (sizeof(SOCKET_ADDRESS) + 16)
  48     private static final int DATA_BUFFER_SIZE = 88;
  49 
  50     private final long handle;
  51     private final int completionKey;
  52     private final Iocp iocp;
  53 
  54     // typically there will be zero, or one I/O operations pending. In rare
  55     // cases there may be more. These rare cases arise when a sequence of accept
  56     // operations complete immediately and handled by the initiating thread.




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.nio.ch;
  27 
  28 import java.nio.channels.*;
  29 import java.net.InetSocketAddress;
  30 import java.util.concurrent.Future;
  31 import java.util.concurrent.atomic.AtomicBoolean;
  32 import java.io.IOException;
  33 import java.security.AccessControlContext;
  34 import java.security.AccessController;
  35 import java.security.PrivilegedAction;
  36 import jdk.internal.misc.Unsafe;
  37 
  38 /**
  39  * Windows implementation of AsynchronousServerSocketChannel using overlapped I/O.
  40  */
  41 
  42 class WindowsAsynchronousServerSocketChannelImpl
  43     extends AsynchronousServerSocketChannelImpl implements Iocp.OverlappedChannel
  44 {
  45     private static final Unsafe unsafe = Unsafe.getUnsafe();
  46 
  47     // 2 * (sizeof(SOCKET_ADDRESS) + 16)
  48     private static final int DATA_BUFFER_SIZE = 88;
  49 
  50     private final long handle;
  51     private final int completionKey;
  52     private final Iocp iocp;
  53 
  54     // typically there will be zero, or one I/O operations pending. In rare
  55     // cases there may be more. These rare cases arise when a sequence of accept
  56     // operations complete immediately and handled by the initiating thread.