提交 849dff95 编写于 作者: R robm

7118373: (se) Potential leak file descriptor when deregistrating at around the...

7118373: (se) Potential leak file descriptor when deregistrating at around the same time as an async close
Reviewed-by: alanb
上级 8093d22a
/* /*
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -970,7 +970,8 @@ class DatagramChannelImpl ...@@ -970,7 +970,8 @@ class DatagramChannelImpl
protected void implCloseSelectableChannel() throws IOException { protected void implCloseSelectableChannel() throws IOException {
synchronized (stateLock) { synchronized (stateLock) {
nd.preClose(fd); if (state != ST_KILLED)
nd.preClose(fd);
ResourceManager.afterUdpClose(); ResourceManager.afterUdpClose();
// if member of mulitcast group then invalidate all keys // if member of mulitcast group then invalidate all keys
......
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -261,7 +261,8 @@ class ServerSocketChannelImpl ...@@ -261,7 +261,8 @@ class ServerSocketChannelImpl
protected void implCloseSelectableChannel() throws IOException { protected void implCloseSelectableChannel() throws IOException {
synchronized (stateLock) { synchronized (stateLock) {
nd.preClose(fd); if (state != ST_KILLED)
nd.preClose(fd);
long th = thread; long th = thread;
if (th != 0) if (th != 0)
NativeThread.signal(th); NativeThread.signal(th);
......
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -816,7 +816,8 @@ class SocketChannelImpl ...@@ -816,7 +816,8 @@ class SocketChannelImpl
// channel from using the old fd, which might be recycled in the // channel from using the old fd, which might be recycled in the
// meantime and allocated to an entirely different channel. // meantime and allocated to an entirely different channel.
// //
nd.preClose(fd); if (state != ST_KILLED)
nd.preClose(fd);
// Signal native threads, if needed. If a target thread is not // Signal native threads, if needed. If a target thread is not
// currently blocked in an I/O operation then no harm is done since // currently blocked in an I/O operation then no harm is done since
......
/* /*
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -84,7 +84,8 @@ class SinkChannelImpl ...@@ -84,7 +84,8 @@ class SinkChannelImpl
protected void implCloseSelectableChannel() throws IOException { protected void implCloseSelectableChannel() throws IOException {
synchronized (stateLock) { synchronized (stateLock) {
nd.preClose(fd); if (state != ST_KILLED)
nd.preClose(fd);
long th = thread; long th = thread;
if (th != 0) if (th != 0)
NativeThread.signal(th); NativeThread.signal(th);
......
/* /*
* Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -84,7 +84,8 @@ class SourceChannelImpl ...@@ -84,7 +84,8 @@ class SourceChannelImpl
protected void implCloseSelectableChannel() throws IOException { protected void implCloseSelectableChannel() throws IOException {
synchronized (stateLock) { synchronized (stateLock) {
nd.preClose(fd); if (state != ST_KILLED)
nd.preClose(fd);
long th = thread; long th = thread;
if (th != 0) if (th != 0)
NativeThread.signal(th); NativeThread.signal(th);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册