# HG changeset patch # User robm # Date 1341253955 -3600 # Node ID 2141a68fb2a7c48a969f73147c28c635a4dc1950 # Parent e88d9099b6f02fcea7caed8b15a95dbc1566df42 7174887: Deadlock in jndi ldap connection cleanup Reviewed-by: xuelei diff -r e88d9099b6f0 -r 2141a68fb2a7 jdk/src/share/classes/com/sun/jndi/ldap/Connection.java --- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java Fri Jun 29 16:16:13 2012 -0700 +++ b/jdk/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 @@ -680,9 +680,11 @@ ldr = ldr.next; } } - parent.processConnectionClosure(); } } + if (nparent) { + parent.processConnectionClosure(); + } } diff -r e88d9099b6f0 -r 2141a68fb2a7 jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java --- a/jdk/src/share/classes/com/sun/jndi/ldap/LdapClient.java Fri Jun 29 16:16:13 2012 -0700 +++ b/jdk/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 @@ -488,14 +488,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