diff --git a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/src/share/classes/sun/nio/ch/DatagramChannelImpl.java index 466a5dba0589d6bc075242c5a5c6517afbe4c542..638689350594e877d6f5316a3d5e7dcce9d7d9cc 100644 --- a/src/share/classes/sun/nio/ch/DatagramChannelImpl.java +++ b/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/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java b/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java index 671fad277337ad2d7c8c7c0bad0f5400667c6af7..a7f90a9660c95c3f4908a300d8e55e6137873005 100644 --- a/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java +++ b/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/src/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/share/classes/sun/nio/ch/SocketChannelImpl.java index ba55ab1b0ed0a39ea454ebfe8159fbf77c065e5d..fe2c5fe33ac02a815c21aa0b3ab9194adc5eefd0 100644 --- a/src/share/classes/sun/nio/ch/SocketChannelImpl.java +++ b/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/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java b/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java index 6e89d063f2e160857f585f30365b85e113cbe389..e99c184f8e9999af3f02936384d5c9adae406b25 100644 --- a/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java +++ b/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/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java b/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java index 915573b9869314e4b525d1a0db6c4084fa7bbca0..b6b005ae315abb4b89c8b4bd62408c4f0ce5a59a 100644 --- a/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java +++ b/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);