# HG changeset patch # User michaelm # Date 1325755601 0 # Node ID 48ac2f190ad1e12eb5092e6f2b1bb1e7c10b88c2 # Parent e6edf9c4d5075bcc88b286aad95fd844686f730e# Parent 6fe1094ea7d3b59cedc1ff057dea7ffe1a0c42fe Merge diff -r e6edf9c4d507 -r 48ac2f190ad1 .hgtags --- a/.hgtags Thu Dec 29 09:21:13 2011 -0800 +++ b/.hgtags Thu Jan 05 09:26:41 2012 +0000 @@ -142,3 +142,6 @@ 456ff1f14b14ef8cfe47cef95c8094f8443fa092 jdk7u2-b13 62b846b0c3259cae732e75df50a1b180a2541178 jdk7u2-b21 1ba1205119dc3df49bd85360a579fdb895a2fb46 jdk7u4-b200 +de83741c8ba0c01c8ac515daaad3318dd96b57bf jdk7u4-b04 +6dd348fb709145bb005acf8533fd6b5444daaba2 jdk7u4-b02 +1a7656c7a8b9d0572ac75c2c325429a7dd5e1a97 jdk7u4-b05 \ No newline at end of file diff -r e6edf9c4d507 -r 48ac2f190ad1 src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java --- a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java Thu Dec 29 09:21:13 2011 -0800 +++ b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java Thu Jan 05 09:26:41 2012 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2011, 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 @@ -113,6 +113,9 @@ import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl; import com.sun.corba.se.impl.util.JDKBridge; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ConcurrentHashMap; + /** * ClientDelegate is the RMI client-side subcontract or representation * It implements RMI delegate as well as our internal ClientRequestDispatcher @@ -122,6 +125,9 @@ implements ClientRequestDispatcher { + private ConcurrentMap locks = + new ConcurrentHashMap(); + public OutputObject beginRequest(Object self, String opName, boolean isOneWay, ContactInfo contactInfo) { @@ -148,8 +154,21 @@ // This locking is done so that multiple connections are not created // for the same endpoint - //6929137 - Synchronized on contactInfo to avoid blocking across multiple endpoints - synchronized (contactInfo) { + // 7046238 - Synchronization on a single monitor for contactInfo parameters + // with identical hashCode(), so we lock on same monitor for equal parameters + // (which can refer to equal (in terms of equals()) but not the same objects) + + Object lock = locks.get(contactInfo); + + if (lock == null) { + Object newLock = new Object(); + lock = locks.putIfAbsent(contactInfo, newLock); + if (lock == null) { + lock = newLock; + } + } + + synchronized (lock) { if (contactInfo.isConnectionBased()) { if (contactInfo.shouldCacheConnection()) { connection = (CorbaConnection) @@ -254,7 +273,7 @@ registerWaiter(messageMediator); // Do connection reclaim now - synchronized (contactInfo) { + synchronized (lock) { if (contactInfo.isConnectionBased()) { if (contactInfo.shouldCacheConnection()) { OutboundConnectionCache connectionCache =