Mercurial > hg > openjdk > icedtea > jdk7 > jdk
changeset 5468:9fb1e142ebe6
7174887: Deadlock in jndi ldap connection cleanup
Reviewed-by: xuelei
author | robm |
---|---|
date | Mon, 02 Jul 2012 19:32:35 +0100 |
parents | 9ca4ae899116 |
children | c85fa4a6df4e |
files | src/share/classes/com/sun/jndi/ldap/Connection.java src/share/classes/com/sun/jndi/ldap/LdapClient.java |
diffstat | 2 files changed, 14 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/jndi/ldap/Connection.java Thu Jun 28 16:12:58 2012 -0700 +++ b/src/share/classes/com/sun/jndi/ldap/Connection.java Mon Jul 02 19:32:35 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -685,9 +685,11 @@ ldr = ldr.next; } } - parent.processConnectionClosure(); } } + if (nparent) { + parent.processConnectionClosure(); + } }
--- a/src/share/classes/com/sun/jndi/ldap/LdapClient.java Thu Jun 28 16:12:58 2012 -0700 +++ b/src/share/classes/com/sun/jndi/ldap/LdapClient.java Mon Jul 02 19:32:35 2012 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -487,14 +487,16 @@ */ void processConnectionClosure() { // Notify listeners - if (unsolicited.size() > 0) { - String msg; - if (conn != null) { - msg = conn.host + ":" + conn.port + " connection closed"; - } else { - msg = "Connection closed"; + synchronized (unsolicited) { + if (unsolicited.size() > 0) { + String msg; + if (conn != null) { + msg = conn.host + ":" + conn.port + " connection closed"; + } else { + msg = "Connection closed"; + } + notifyUnsolicited(new CommunicationException(msg)); } - notifyUnsolicited(new CommunicationException(msg)); } // Remove from pool