src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousSocketChannelImpl.java
equal
deleted
inserted
replaced
33 import java.io.IOException; |
33 import java.io.IOException; |
34 import java.security.AccessController; |
34 import java.security.AccessController; |
35 import java.security.PrivilegedActionException; |
35 import java.security.PrivilegedActionException; |
36 import java.security.PrivilegedExceptionAction; |
36 import java.security.PrivilegedExceptionAction; |
37 import jdk.internal.misc.Unsafe; |
37 import jdk.internal.misc.Unsafe; |
|
38 import sun.net.util.SocketExceptions; |
38 |
39 |
39 /** |
40 /** |
40 * Windows implementation of AsynchronousSocketChannel using overlapped I/O. |
41 * Windows implementation of AsynchronousSocketChannel using overlapped I/O. |
41 */ |
42 */ |
42 |
43 |
251 end(); |
252 end(); |
252 } |
253 } |
253 |
254 |
254 if (exc != null) { |
255 if (exc != null) { |
255 closeChannel(); |
256 closeChannel(); |
256 result.setFailure(toIOException(exc)); |
257 exc = SocketExceptions.of(toIOException(exc), remote); |
|
258 result.setFailure(exc); |
257 } |
259 } |
258 Invoker.invoke(result); |
260 Invoker.invoke(result); |
259 } |
261 } |
260 |
262 |
261 /** |
263 /** |
276 } |
278 } |
277 |
279 |
278 // can't close channel while in begin/end block |
280 // can't close channel while in begin/end block |
279 if (exc != null) { |
281 if (exc != null) { |
280 closeChannel(); |
282 closeChannel(); |
281 result.setFailure(toIOException(exc)); |
283 IOException ee = toIOException(exc); |
|
284 ee = SocketExceptions.of(ee, remote); |
|
285 result.setFailure(ee); |
282 } |
286 } |
283 |
287 |
284 if (canInvokeDirect) { |
288 if (canInvokeDirect) { |
285 Invoker.invokeUnchecked(result); |
289 Invoker.invokeUnchecked(result); |
286 } else { |
290 } else { |
291 /** |
295 /** |
292 * Invoked by handler thread when failed to establish connection. |
296 * Invoked by handler thread when failed to establish connection. |
293 */ |
297 */ |
294 @Override |
298 @Override |
295 public void failed(int error, IOException x) { |
299 public void failed(int error, IOException x) { |
|
300 x = SocketExceptions.of(x, remote); |
296 if (isOpen()) { |
301 if (isOpen()) { |
297 closeChannel(); |
302 closeChannel(); |
298 result.setFailure(x); |
303 result.setFailure(x); |
299 } else { |
304 } else { |
300 result.setFailure(new AsynchronousCloseException()); |
305 x = SocketExceptions.of(new AsynchronousCloseException(), remote); |
|
306 result.setFailure(x); |
301 } |
307 } |
302 Invoker.invoke(result); |
308 Invoker.invoke(result); |
303 } |
309 } |
304 } |
310 } |
305 |
311 |