< prev index next >

src/java.base/share/classes/sun/nio/ch/ServerSocketChannelImpl.java

Print this page
*** 90,11 ***
      private static final int ST_CLOSING = 1;
      private static final int ST_CLOSED = 2;
      private int state;
  
      // ID of native thread currently blocked in this channel, for signalling
!     private long thread;
  
      // Binding
      private SocketAddress localAddress; // null => unbound
  
      // set true when exclusive binding is on and SO_REUSEADDR is emulated
--- 90,11 ---
      private static final int ST_CLOSING = 1;
      private static final int ST_CLOSED = 2;
      private int state;
  
      // ID of native thread currently blocked in this channel, for signalling
!     private NativeThread thread;
  
      // Binding
      private SocketAddress localAddress; // null => unbound
  
      // set true when exclusive binding is on and SO_REUSEADDR is emulated

*** 364,11 ***
      private void end(boolean blocking, boolean completed)
          throws AsynchronousCloseException
      {
          if (blocking) {
              synchronized (stateLock) {
!                 thread = 0;
                  if (state == ST_CLOSING) {
                      tryFinishClose();
                  }
              }
              end(completed);
--- 364,11 ---
      private void end(boolean blocking, boolean completed)
          throws AsynchronousCloseException
      {
          if (blocking) {
              synchronized (stateLock) {
!                 thread = null;
                  if (state == ST_CLOSING) {
                      tryFinishClose();
                  }
              }
              end(completed);

*** 551,11 ***
       * Closes the socket if there are no accept in progress and the channel is
       * not registered with a Selector.
       */
      private boolean tryClose() throws IOException {
          assert Thread.holdsLock(stateLock) && state == ST_CLOSING;
!         if ((thread == 0) && !isRegistered()) {
              state = ST_CLOSED;
              nd.close(fd);
              return true;
          } else {
              return false;
--- 551,11 ---
       * Closes the socket if there are no accept in progress and the channel is
       * not registered with a Selector.
       */
      private boolean tryClose() throws IOException {
          assert Thread.holdsLock(stateLock) && state == ST_CLOSING;
!         if ((thread == null) && !isRegistered()) {
              state = ST_CLOSED;
              nd.close(fd);
              return true;
          } else {
              return false;

*** 583,11 ***
      private void implCloseBlockingMode() throws IOException {
          synchronized (stateLock) {
              assert state < ST_CLOSING;
              state = ST_CLOSING;
              if (!tryClose()) {
!                 nd.preClose(fd, thread, 0);
              }
          }
      }
  
      /**
--- 583,11 ---
      private void implCloseBlockingMode() throws IOException {
          synchronized (stateLock) {
              assert state < ST_CLOSING;
              state = ST_CLOSING;
              if (!tryClose()) {
!                 nd.preClose(fd, thread, null);
              }
          }
      }
  
      /**
< prev index next >