32 import java.io.IOException;
33 import java.io.FileDescriptor;
34 import sun.net.NetHooks;
35 import sun.net.util.SocketExceptions;
36 import sun.security.action.GetPropertyAction;
37
38 /**
39 * Unix implementation of AsynchronousSocketChannel
40 */
41
42 class UnixAsynchronousSocketChannelImpl
43 extends AsynchronousSocketChannelImpl implements Port.PollableChannel
44 {
45 private static final NativeDispatcher nd = new SocketDispatcher();
46 private static enum OpType { CONNECT, READ, WRITE };
47
48 private static final boolean disableSynchronousRead;
49 static {
50 String propValue = GetPropertyAction.privilegedGetProperty(
51 "sun.nio.ch.disableSynchronousRead", "false");
52 disableSynchronousRead = (propValue.length() == 0) ?
53 true : Boolean.valueOf(propValue);
54 }
55
56 private final Port port;
57 private final int fdVal;
58
59 // used to ensure that the context for I/O operations that complete
60 // ascynrhonously is visible to the pooled threads handling I/O events.
61 private final Object updateLock = new Object();
62
63 // pending connect (updateLock)
64 private boolean connectPending;
65 private CompletionHandler<Void,Object> connectHandler;
66 private Object connectAttachment;
67 private PendingFuture<Void,Object> connectFuture;
68
69 // pending remote address (stateLock)
70 private SocketAddress pendingRemote;
71
72 // pending read (updateLock)
73 private boolean readPending;
|
32 import java.io.IOException;
33 import java.io.FileDescriptor;
34 import sun.net.NetHooks;
35 import sun.net.util.SocketExceptions;
36 import sun.security.action.GetPropertyAction;
37
38 /**
39 * Unix implementation of AsynchronousSocketChannel
40 */
41
42 class UnixAsynchronousSocketChannelImpl
43 extends AsynchronousSocketChannelImpl implements Port.PollableChannel
44 {
45 private static final NativeDispatcher nd = new SocketDispatcher();
46 private static enum OpType { CONNECT, READ, WRITE };
47
48 private static final boolean disableSynchronousRead;
49 static {
50 String propValue = GetPropertyAction.privilegedGetProperty(
51 "sun.nio.ch.disableSynchronousRead", "false");
52 disableSynchronousRead = propValue.isEmpty() ?
53 true : Boolean.parseBoolean(propValue);
54 }
55
56 private final Port port;
57 private final int fdVal;
58
59 // used to ensure that the context for I/O operations that complete
60 // ascynrhonously is visible to the pooled threads handling I/O events.
61 private final Object updateLock = new Object();
62
63 // pending connect (updateLock)
64 private boolean connectPending;
65 private CompletionHandler<Void,Object> connectHandler;
66 private Object connectAttachment;
67 private PendingFuture<Void,Object> connectFuture;
68
69 // pending remote address (stateLock)
70 private SocketAddress pendingRemote;
71
72 // pending read (updateLock)
73 private boolean readPending;
|