diff --git a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java index 466a5dba058..63868935059 100644 --- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java +++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -970,7 +970,8 @@ class DatagramChannelImpl protected void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + if (state != ST_KILLED) + nd.preClose(fd); ResourceManager.afterUdpClose(); // if member of mulitcast group then invalidate all keys diff --git a/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java index 671fad27733..a7f90a9660c 100644 --- a/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java +++ b/jdk/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -261,7 +261,8 @@ class ServerSocketChannelImpl protected void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + if (state != ST_KILLED) + nd.preClose(fd); long th = thread; if (th != 0) NativeThread.signal(th); diff --git a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java index ba55ab1b0ed..fe2c5fe33ac 100644 --- a/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java +++ b/jdk/src/share/classes/sun/nio/ch/SocketChannelImpl.java @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -816,7 +816,8 @@ class SocketChannelImpl // channel from using the old fd, which might be recycled in the // 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 // currently blocked in an I/O operation then no harm is done since diff --git a/jdk/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java index 6e89d063f2e..e99c184f8e9 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java +++ b/jdk/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -84,7 +84,8 @@ class SinkChannelImpl protected void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + if (state != ST_KILLED) + nd.preClose(fd); long th = thread; if (th != 0) NativeThread.signal(th); diff --git a/jdk/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java b/jdk/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java index 915573b9869..b6b005ae315 100644 --- a/jdk/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java +++ b/jdk/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java @@ -1,5 +1,5 @@ /* - * 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. * * This code is free software; you can redistribute it and/or modify it @@ -84,7 +84,8 @@ class SourceChannelImpl protected void implCloseSelectableChannel() throws IOException { synchronized (stateLock) { - nd.preClose(fd); + if (state != ST_KILLED) + nd.preClose(fd); long th = thread; if (th != 0) NativeThread.signal(th);