14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
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.nio.ByteBuffer;
30 import java.net.*;
31 import java.util.concurrent.*;
32 import java.io.IOException;
33 import java.io.FileDescriptor;
34 import java.security.AccessController;
35 import sun.net.NetHooks;
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 = AccessController.doPrivileged(
51 new GetPropertyAction("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
|
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
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.nio.ByteBuffer;
30 import java.net.*;
31 import java.util.concurrent.*;
32 import java.io.IOException;
33 import java.io.FileDescriptor;
34 import sun.net.NetHooks;
35 import sun.security.action.GetPropertyAction;
36
37 /**
38 * Unix implementation of AsynchronousSocketChannel
39 */
40
41 class UnixAsynchronousSocketChannelImpl
42 extends AsynchronousSocketChannelImpl implements Port.PollableChannel
43 {
44 private static final NativeDispatcher nd = new SocketDispatcher();
45 private static enum OpType { CONNECT, READ, WRITE };
46
47 private static final boolean disableSynchronousRead;
48 static {
49 String propValue = GetPropertyAction
50 .getProperty("sun.nio.ch.disableSynchronousRead", "false");
51 disableSynchronousRead = (propValue.length() == 0) ?
52 true : Boolean.valueOf(propValue);
53 }
54
55 private final Port port;
56 private final int fdVal;
57
58 // used to ensure that the context for I/O operations that complete
59 // ascynrhonously is visible to the pooled threads handling I/O events.
60 private final Object updateLock = new Object();
61
62 // pending connect (updateLock)
63 private boolean connectPending;
64 private CompletionHandler<Void,Object> connectHandler;
65 private Object connectAttachment;
66 private PendingFuture<Void,Object> connectFuture;
67
68 // pending remote address (stateLock)
69 private SocketAddress pendingRemote;
70
|