author | chegar |
Wed, 29 May 2019 13:58:05 +0100 | |
changeset 55081 | dd321e3596c0 |
parent 54620 | 13b67c1420b8 |
child 58614 | 29624901d8bc |
permissions | -rw-r--r-- |
2 | 1 |
/* |
54246
f04e3492fd88
8221252: (sc) SocketChannel and its socket adaptor need to handle connection reset
alanb
parents:
49001
diff
changeset
|
2 |
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
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 |
* |
|
5506 | 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. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.nio.ch; |
|
27 |
||
48761 | 28 |
import java.io.IOException; |
29 |
import java.io.InputStream; |
|
30 |
import java.io.OutputStream; |
|
31 |
import java.net.InetAddress; |
|
32 |
import java.net.InetSocketAddress; |
|
33 |
import java.net.Socket; |
|
34 |
import java.net.SocketAddress; |
|
35 |
import java.net.SocketException; |
|
36 |
import java.net.SocketOption; |
|
37 |
import java.net.StandardSocketOptions; |
|
38 |
import java.nio.channels.SocketChannel; |
|
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
39 |
import java.util.Set; |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
40 |
|
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
41 |
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
2 | 42 |
|
43 |
// Make a socket channel look like a socket. |
|
44 |
// |
|
45 |
// The methods in this class are defined in exactly the same order as in |
|
46 |
// java.net.Socket so as to simplify tracking future changes to that class. |
|
47 |
// |
|
48 |
||
48761 | 49 |
class SocketAdaptor |
2 | 50 |
extends Socket |
51 |
{ |
|
52 |
// The channel being adapted |
|
53 |
private final SocketChannelImpl sc; |
|
54 |
||
55 |
// Timeout "option" value for reads |
|
34774
03b4e6dc367b
8145680: Remove unnecessary explicit initialization of volatile variables in java.base
redestad
parents:
29224
diff
changeset
|
56 |
private volatile int timeout; |
2 | 57 |
|
11106
802bb70d8fa2
7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor
chegar
parents:
9679
diff
changeset
|
58 |
private SocketAdaptor(SocketChannelImpl sc) throws SocketException { |
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
59 |
super(DummySocketImpl.create()); |
2 | 60 |
this.sc = sc; |
61 |
} |
|
62 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
63 |
static Socket create(SocketChannelImpl sc) { |
11106
802bb70d8fa2
7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor
chegar
parents:
9679
diff
changeset
|
64 |
try { |
802bb70d8fa2
7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor
chegar
parents:
9679
diff
changeset
|
65 |
return new SocketAdaptor(sc); |
802bb70d8fa2
7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor
chegar
parents:
9679
diff
changeset
|
66 |
} catch (SocketException e) { |
802bb70d8fa2
7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor
chegar
parents:
9679
diff
changeset
|
67 |
throw new InternalError("Should not reach here"); |
802bb70d8fa2
7115586: Suppress creation of SocketImpl in SocketAdaptor's constructor
chegar
parents:
9679
diff
changeset
|
68 |
} |
2 | 69 |
} |
70 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
71 |
@Override |
2 | 72 |
public void connect(SocketAddress remote) throws IOException { |
73 |
connect(remote, 0); |
|
74 |
} |
|
75 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
76 |
@Override |
2 | 77 |
public void connect(SocketAddress remote, int timeout) throws IOException { |
78 |
if (remote == null) |
|
79 |
throw new IllegalArgumentException("connect: The address can't be null"); |
|
80 |
if (timeout < 0) |
|
81 |
throw new IllegalArgumentException("connect: timeout can't be negative"); |
|
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
82 |
try { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
83 |
if (timeout > 0) { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
84 |
long nanos = MILLISECONDS.toNanos(timeout); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
85 |
sc.blockingConnect(remote, nanos); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
86 |
} else { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
87 |
sc.blockingConnect(remote, Long.MAX_VALUE); |
2 | 88 |
} |
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
89 |
} catch (Exception e) { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
90 |
Net.translateException(e, true); |
2 | 91 |
} |
92 |
} |
|
93 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
94 |
@Override |
2 | 95 |
public void bind(SocketAddress local) throws IOException { |
96 |
try { |
|
97 |
sc.bind(local); |
|
98 |
} catch (Exception x) { |
|
99 |
Net.translateException(x); |
|
100 |
} |
|
101 |
} |
|
102 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
103 |
@Override |
2 | 104 |
public InetAddress getInetAddress() { |
49001
ce06058197a4
8198562: (ch) Separate blocking and non-blocking code paths (part 1)
alanb
parents:
48761
diff
changeset
|
105 |
InetSocketAddress remote = sc.remoteAddress(); |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
106 |
if (remote == null) { |
2 | 107 |
return null; |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
108 |
} else { |
49001
ce06058197a4
8198562: (ch) Separate blocking and non-blocking code paths (part 1)
alanb
parents:
48761
diff
changeset
|
109 |
return remote.getAddress(); |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
110 |
} |
2 | 111 |
} |
112 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
113 |
@Override |
2 | 114 |
public InetAddress getLocalAddress() { |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
115 |
if (sc.isOpen()) { |
18212
22f8c33b0690
8001318: Socket.getLocalAddress not consistent with InetAddress.getLocalHost
khazra
parents:
14342
diff
changeset
|
116 |
InetSocketAddress local = sc.localAddress(); |
22f8c33b0690
8001318: Socket.getLocalAddress not consistent with InetAddress.getLocalHost
khazra
parents:
14342
diff
changeset
|
117 |
if (local != null) { |
22f8c33b0690
8001318: Socket.getLocalAddress not consistent with InetAddress.getLocalHost
khazra
parents:
14342
diff
changeset
|
118 |
return Net.getRevealedLocalAddress(local).getAddress(); |
22f8c33b0690
8001318: Socket.getLocalAddress not consistent with InetAddress.getLocalHost
khazra
parents:
14342
diff
changeset
|
119 |
} |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
120 |
} |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
121 |
return new InetSocketAddress(0).getAddress(); |
2 | 122 |
} |
123 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
124 |
@Override |
2 | 125 |
public int getPort() { |
49001
ce06058197a4
8198562: (ch) Separate blocking and non-blocking code paths (part 1)
alanb
parents:
48761
diff
changeset
|
126 |
InetSocketAddress remote = sc.remoteAddress(); |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
127 |
if (remote == null) { |
2 | 128 |
return 0; |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
129 |
} else { |
49001
ce06058197a4
8198562: (ch) Separate blocking and non-blocking code paths (part 1)
alanb
parents:
48761
diff
changeset
|
130 |
return remote.getPort(); |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
131 |
} |
2 | 132 |
} |
133 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
134 |
@Override |
2 | 135 |
public int getLocalPort() { |
49001
ce06058197a4
8198562: (ch) Separate blocking and non-blocking code paths (part 1)
alanb
parents:
48761
diff
changeset
|
136 |
InetSocketAddress local = sc.localAddress(); |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
137 |
if (local == null) { |
2 | 138 |
return -1; |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
139 |
} else { |
49001
ce06058197a4
8198562: (ch) Separate blocking and non-blocking code paths (part 1)
alanb
parents:
48761
diff
changeset
|
140 |
return local.getPort(); |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
141 |
} |
2 | 142 |
} |
143 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
144 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
145 |
public SocketAddress getRemoteSocketAddress() { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
146 |
return sc.remoteAddress(); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
147 |
} |
48761 | 148 |
|
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
149 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
150 |
public SocketAddress getLocalSocketAddress() { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
151 |
InetSocketAddress local = sc.localAddress(); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
152 |
if (local != null) { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
153 |
return Net.getRevealedLocalAddress(local); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
154 |
} else { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
155 |
return null; |
54246
f04e3492fd88
8221252: (sc) SocketChannel and its socket adaptor need to handle connection reset
alanb
parents:
49001
diff
changeset
|
156 |
} |
2 | 157 |
} |
158 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
159 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
160 |
public SocketChannel getChannel() { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
161 |
return sc; |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
162 |
} |
2 | 163 |
|
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
164 |
@Override |
2 | 165 |
public InputStream getInputStream() throws IOException { |
166 |
if (!sc.isOpen()) |
|
167 |
throw new SocketException("Socket is closed"); |
|
168 |
if (!sc.isConnected()) |
|
169 |
throw new SocketException("Socket is not connected"); |
|
170 |
if (!sc.isInputOpen()) |
|
171 |
throw new SocketException("Socket input is shutdown"); |
|
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
172 |
return new InputStream() { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
173 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
174 |
public int read() throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
175 |
byte[] a = new byte[1]; |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
176 |
int n = read(a, 0, 1); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
177 |
return (n > 0) ? (a[0] & 0xff) : -1; |
2 | 178 |
} |
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
179 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
180 |
public int read(byte[] b, int off, int len) throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
181 |
int timeout = SocketAdaptor.this.timeout; |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
182 |
if (timeout > 0) { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
183 |
long nanos = MILLISECONDS.toNanos(timeout); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
184 |
return sc.blockingRead(b, off, len, nanos); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
185 |
} else { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
186 |
return sc.blockingRead(b, off, len, 0); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
187 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
188 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
189 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
190 |
public int available() throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
191 |
return sc.available(); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
192 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
193 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
194 |
public void close() throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
195 |
sc.close(); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
196 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
197 |
}; |
2 | 198 |
} |
199 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
200 |
@Override |
2 | 201 |
public OutputStream getOutputStream() throws IOException { |
202 |
if (!sc.isOpen()) |
|
203 |
throw new SocketException("Socket is closed"); |
|
204 |
if (!sc.isConnected()) |
|
205 |
throw new SocketException("Socket is not connected"); |
|
206 |
if (!sc.isOutputOpen()) |
|
207 |
throw new SocketException("Socket output is shutdown"); |
|
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
208 |
return new OutputStream() { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
209 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
210 |
public void write(int b) throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
211 |
byte[] a = new byte[]{(byte) b}; |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
212 |
write(a, 0, 1); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
213 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
214 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
215 |
public void write(byte[] b, int off, int len) throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
216 |
sc.blockingWriteFully(b, off, len); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
217 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
218 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
219 |
public void close() throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
220 |
sc.close(); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
221 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
222 |
}; |
2 | 223 |
} |
224 |
||
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
225 |
private void setBooleanOption(SocketOption<Boolean> name, boolean value) |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
226 |
throws SocketException |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
227 |
{ |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
228 |
try { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
229 |
sc.setOption(name, value); |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
230 |
} catch (IOException x) { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
231 |
Net.translateToSocketException(x); |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
232 |
} |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
233 |
} |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
234 |
|
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
235 |
private void setIntOption(SocketOption<Integer> name, int value) |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
236 |
throws SocketException |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
237 |
{ |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
238 |
try { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
239 |
sc.setOption(name, value); |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
240 |
} catch (IOException x) { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
241 |
Net.translateToSocketException(x); |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
242 |
} |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
243 |
} |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
244 |
|
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
245 |
private boolean getBooleanOption(SocketOption<Boolean> name) throws SocketException { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
246 |
try { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
247 |
return sc.getOption(name).booleanValue(); |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
248 |
} catch (IOException x) { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
249 |
Net.translateToSocketException(x); |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
250 |
return false; // keep compiler happy |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
251 |
} |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
252 |
} |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
253 |
|
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
254 |
private int getIntOption(SocketOption<Integer> name) throws SocketException { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
255 |
try { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
256 |
return sc.getOption(name).intValue(); |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
257 |
} catch (IOException x) { |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
258 |
Net.translateToSocketException(x); |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
259 |
return -1; // keep compiler happy |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
260 |
} |
2 | 261 |
} |
262 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
263 |
@Override |
2 | 264 |
public void setTcpNoDelay(boolean on) throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
265 |
setBooleanOption(StandardSocketOptions.TCP_NODELAY, on); |
2 | 266 |
} |
267 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
268 |
@Override |
2 | 269 |
public boolean getTcpNoDelay() throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
270 |
return getBooleanOption(StandardSocketOptions.TCP_NODELAY); |
2 | 271 |
} |
272 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
273 |
@Override |
2 | 274 |
public void setSoLinger(boolean on, int linger) throws SocketException { |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
275 |
if (!on) |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
276 |
linger = -1; |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
277 |
setIntOption(StandardSocketOptions.SO_LINGER, linger); |
2 | 278 |
} |
279 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
280 |
@Override |
2 | 281 |
public int getSoLinger() throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
282 |
return getIntOption(StandardSocketOptions.SO_LINGER); |
2 | 283 |
} |
284 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
285 |
@Override |
2 | 286 |
public void sendUrgentData(int data) throws IOException { |
29224
8433f5f46142
8071599: (so) Socket adapter sendUrgentData throws IllegalBlockingMode when channel configured non-blocking
bpb
parents:
25859
diff
changeset
|
287 |
int n = sc.sendOutOfBandData((byte) data); |
8433f5f46142
8071599: (so) Socket adapter sendUrgentData throws IllegalBlockingMode when channel configured non-blocking
bpb
parents:
25859
diff
changeset
|
288 |
if (n == 0) |
8433f5f46142
8071599: (so) Socket adapter sendUrgentData throws IllegalBlockingMode when channel configured non-blocking
bpb
parents:
25859
diff
changeset
|
289 |
throw new IOException("Socket buffer full"); |
2 | 290 |
} |
291 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
292 |
@Override |
2 | 293 |
public void setOOBInline(boolean on) throws SocketException { |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
294 |
setBooleanOption(ExtendedSocketOption.SO_OOBINLINE, on); |
2 | 295 |
} |
296 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
297 |
@Override |
2 | 298 |
public boolean getOOBInline() throws SocketException { |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
299 |
return getBooleanOption(ExtendedSocketOption.SO_OOBINLINE); |
2 | 300 |
} |
301 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
302 |
@Override |
2 | 303 |
public void setSoTimeout(int timeout) throws SocketException { |
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
304 |
if (!sc.isOpen()) |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
305 |
throw new SocketException("Socket is closed"); |
2 | 306 |
if (timeout < 0) |
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
307 |
throw new IllegalArgumentException("timeout < 0"); |
2 | 308 |
this.timeout = timeout; |
309 |
} |
|
310 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
311 |
@Override |
2 | 312 |
public int getSoTimeout() throws SocketException { |
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
313 |
if (!sc.isOpen()) |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
314 |
throw new SocketException("Socket is closed"); |
2 | 315 |
return timeout; |
316 |
} |
|
317 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
318 |
@Override |
2 | 319 |
public void setSendBufferSize(int size) throws SocketException { |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
320 |
// size 0 valid for SocketChannel, invalid for Socket |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
321 |
if (size <= 0) |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
322 |
throw new IllegalArgumentException("Invalid send size"); |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
323 |
setIntOption(StandardSocketOptions.SO_SNDBUF, size); |
2 | 324 |
} |
325 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
326 |
@Override |
2 | 327 |
public int getSendBufferSize() throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
328 |
return getIntOption(StandardSocketOptions.SO_SNDBUF); |
2 | 329 |
} |
330 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
331 |
@Override |
2 | 332 |
public void setReceiveBufferSize(int size) throws SocketException { |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
333 |
// size 0 valid for SocketChannel, invalid for Socket |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
334 |
if (size <= 0) |
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
335 |
throw new IllegalArgumentException("Invalid receive size"); |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
336 |
setIntOption(StandardSocketOptions.SO_RCVBUF, size); |
2 | 337 |
} |
338 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
339 |
@Override |
2 | 340 |
public int getReceiveBufferSize() throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
341 |
return getIntOption(StandardSocketOptions.SO_RCVBUF); |
2 | 342 |
} |
343 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
344 |
@Override |
2 | 345 |
public void setKeepAlive(boolean on) throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
346 |
setBooleanOption(StandardSocketOptions.SO_KEEPALIVE, on); |
2 | 347 |
} |
348 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
349 |
@Override |
2 | 350 |
public boolean getKeepAlive() throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
351 |
return getBooleanOption(StandardSocketOptions.SO_KEEPALIVE); |
2 | 352 |
} |
353 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
354 |
@Override |
2 | 355 |
public void setTrafficClass(int tc) throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
356 |
setIntOption(StandardSocketOptions.IP_TOS, tc); |
2 | 357 |
} |
358 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
359 |
@Override |
2 | 360 |
public int getTrafficClass() throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
361 |
return getIntOption(StandardSocketOptions.IP_TOS); |
2 | 362 |
} |
363 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
364 |
@Override |
2 | 365 |
public void setReuseAddress(boolean on) throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
366 |
setBooleanOption(StandardSocketOptions.SO_REUSEADDR, on); |
2 | 367 |
} |
368 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
369 |
@Override |
2 | 370 |
public boolean getReuseAddress() throws SocketException { |
9679
d98ae8bc45fc
7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents:
7668
diff
changeset
|
371 |
return getBooleanOption(StandardSocketOptions.SO_REUSEADDR); |
2 | 372 |
} |
373 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
374 |
@Override |
2 | 375 |
public void close() throws IOException { |
5784
e565c553e9fc
6938230: (so) SocketAdaptor.close() does not translate IOException resulting in Error
alanb
parents:
5506
diff
changeset
|
376 |
sc.close(); |
2 | 377 |
} |
378 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
379 |
@Override |
2 | 380 |
public void shutdownInput() throws IOException { |
381 |
try { |
|
382 |
sc.shutdownInput(); |
|
383 |
} catch (Exception x) { |
|
384 |
Net.translateException(x); |
|
385 |
} |
|
386 |
} |
|
387 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
388 |
@Override |
2 | 389 |
public void shutdownOutput() throws IOException { |
390 |
try { |
|
391 |
sc.shutdownOutput(); |
|
392 |
} catch (Exception x) { |
|
393 |
Net.translateException(x); |
|
394 |
} |
|
395 |
} |
|
396 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
397 |
@Override |
2 | 398 |
public String toString() { |
399 |
if (sc.isConnected()) |
|
400 |
return "Socket[addr=" + getInetAddress() + |
|
401 |
",port=" + getPort() + |
|
402 |
",localport=" + getLocalPort() + "]"; |
|
403 |
return "Socket[unconnected]"; |
|
404 |
} |
|
405 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
406 |
@Override |
2 | 407 |
public boolean isConnected() { |
408 |
return sc.isConnected(); |
|
409 |
} |
|
410 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
411 |
@Override |
2 | 412 |
public boolean isBound() { |
1152
29d6145d1097
4640544: New I/O: Complete socket-channel functionality
alanb
parents:
715
diff
changeset
|
413 |
return sc.localAddress() != null; |
2 | 414 |
} |
415 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
416 |
@Override |
2 | 417 |
public boolean isClosed() { |
418 |
return !sc.isOpen(); |
|
419 |
} |
|
420 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
421 |
@Override |
2 | 422 |
public boolean isInputShutdown() { |
423 |
return !sc.isInputOpen(); |
|
424 |
} |
|
425 |
||
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
426 |
@Override |
2 | 427 |
public boolean isOutputShutdown() { |
428 |
return !sc.isOutputOpen(); |
|
429 |
} |
|
54620
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
430 |
|
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
431 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
432 |
public <T> Socket setOption(SocketOption<T> name, T value) throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
433 |
sc.setOption(name, value); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
434 |
return this; |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
435 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
436 |
|
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
437 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
438 |
public <T> T getOption(SocketOption<T> name) throws IOException { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
439 |
return sc.getOption(name); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
440 |
} |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
441 |
|
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
442 |
@Override |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
443 |
public Set<SocketOption<?>> supportedOptions() { |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
444 |
return sc.supportedOptions(); |
13b67c1420b8
8222774: (ch) Replace uses of stateLock and blockingLock with j.u.c. locks
alanb
parents:
54246
diff
changeset
|
445 |
} |
2 | 446 |
} |