1.1 --- a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java Mon Nov 29 22:10:46 2010 -0800 1.2 +++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java Wed Dec 01 16:46:18 2010 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -245,7 +245,14 @@ 1.11 // All access to resolver, localResolver, and urlOperation must be protected using 1.12 // resolverLock. Do not hold the ORBImpl lock while accessing 1.13 // resolver, or deadlocks may occur. 1.14 - private Object resolverLock ; 1.15 + // Note that we now have separate locks for each resolver type. This is due 1.16 + // to bug 6980681 and 6238477, which was caused by a deadlock while resolving a 1.17 + // corbaname: URL that contained a reference to the same ORB as the 1.18 + // ORB making the call to string_to_object. This caused a deadlock between the 1.19 + // client thread holding the single lock for access to the urlOperation, 1.20 + // and the server thread handling the client is_a request waiting on the 1.21 + // same lock to access the localResolver. 1.22 + 1.23 1.24 // Used for resolver_initial_references and list_initial_services 1.25 private Resolver resolver ; 1.26 @@ -255,8 +262,14 @@ 1.27 1.28 // Converts strings to object references for resolvers and string_to_object 1.29 private Operation urlOperation ; 1.30 + private final Object urlOperationLock = new java.lang.Object() ; 1.31 1.32 private CorbaServerRequestDispatcher insNamingDelegate ; 1.33 + // resolverLock must be used for all access to either resolver or 1.34 + // localResolver, since it is possible for the resolver to indirectly 1.35 + // refer to the localResolver. Also used to protect access to 1.36 + // insNamingDelegate. 1.37 + private final Object resolverLock = new Object() ; 1.38 1.39 private TaggedComponentFactoryFinder taggedComponentFactoryFinder ; 1.40 1.41 @@ -396,7 +409,6 @@ 1.42 } 1.43 }; 1.44 1.45 - resolverLock = new java.lang.Object() ; 1.46 1.47 requestDispatcherRegistry = new RequestDispatcherRegistryImpl( 1.48 this, ORBConstants.DEFAULT_SCID); 1.49 @@ -832,7 +844,7 @@ 1.50 if (str == null) 1.51 throw wrapper.nullParam() ; 1.52 1.53 - synchronized (resolverLock) { 1.54 + synchronized (urlOperationLock) { 1.55 org.omg.CORBA.Object obj = (org.omg.CORBA.Object)op.operate( str ) ; 1.56 return obj ; 1.57 } 1.58 @@ -1778,7 +1790,7 @@ 1.59 */ 1.60 public void setURLOperation( Operation stringToObject ) 1.61 { 1.62 - synchronized (resolverLock) { 1.63 + synchronized (urlOperationLock) { 1.64 urlOperation = stringToObject ; 1.65 } 1.66 } 1.67 @@ -1788,7 +1800,7 @@ 1.68 */ 1.69 public Operation getURLOperation() 1.70 { 1.71 - synchronized (resolverLock) { 1.72 + synchronized (urlOperationLock) { 1.73 return urlOperation ; 1.74 } 1.75 }