< prev index next >

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

Print this page
rev 48757 : [mq]: nio-cleanup


  45 import java.util.HashSet;
  46 import java.util.Set;
  47 import java.util.concurrent.locks.ReentrantLock;
  48 
  49 import sun.net.NetHooks;
  50 
  51 /**
  52  * An implementation of ServerSocketChannels
  53  */
  54 
  55 class ServerSocketChannelImpl
  56     extends ServerSocketChannel
  57     implements SelChImpl
  58 {
  59 
  60     // Used to make native close and configure calls
  61     private static NativeDispatcher nd;
  62 
  63     // Our file descriptor
  64     private final FileDescriptor fd;
  65 
  66     // fd value needed for dev/poll. This value will remain valid
  67     // even after the value in the file descriptor object has been set to -1
  68     private int fdVal;
  69 
  70     // ID of native thread currently blocked in this channel, for signalling
  71     private volatile long thread;
  72 
  73     // Lock held by thread currently blocked in this channel
  74     private final ReentrantLock acceptLock = new ReentrantLock();
  75 
  76     // Lock held by any thread that modifies the state fields declared below
  77     // DO NOT invoke a blocking I/O operation while holding this lock!
  78     private final Object stateLock = new Object();
  79 
  80     // -- The following fields are protected by stateLock
  81 
  82     // Channel state, increases monotonically
  83     private static final int ST_UNINITIALIZED = -1;
  84     private static final int ST_INUSE = 0;
  85     private static final int ST_KILLED = 1;
  86     private int state = ST_UNINITIALIZED;
  87 
  88     // Binding




  45 import java.util.HashSet;
  46 import java.util.Set;
  47 import java.util.concurrent.locks.ReentrantLock;
  48 
  49 import sun.net.NetHooks;
  50 
  51 /**
  52  * An implementation of ServerSocketChannels
  53  */
  54 
  55 class ServerSocketChannelImpl
  56     extends ServerSocketChannel
  57     implements SelChImpl
  58 {
  59 
  60     // Used to make native close and configure calls
  61     private static NativeDispatcher nd;
  62 
  63     // Our file descriptor
  64     private final FileDescriptor fd;
  65     private final int fdVal;



  66 
  67     // ID of native thread currently blocked in this channel, for signalling
  68     private volatile long thread;
  69 
  70     // Lock held by thread currently blocked in this channel
  71     private final ReentrantLock acceptLock = new ReentrantLock();
  72 
  73     // Lock held by any thread that modifies the state fields declared below
  74     // DO NOT invoke a blocking I/O operation while holding this lock!
  75     private final Object stateLock = new Object();
  76 
  77     // -- The following fields are protected by stateLock
  78 
  79     // Channel state, increases monotonically
  80     private static final int ST_UNINITIALIZED = -1;
  81     private static final int ST_INUSE = 0;
  82     private static final int ST_KILLED = 1;
  83     private int state = ST_UNINITIALIZED;
  84 
  85     // Binding


< prev index next >