Index: appclient/server/core/src/main/java/org/glassfish/appclient/server/core/jws/JWSAdapterManager.java =================================================================== --- appclient/server/core/src/main/java/org/glassfish/appclient/server/core/jws/JWSAdapterManager.java (revision 55241) +++ appclient/server/core/src/main/java/org/glassfish/appclient/server/core/jws/JWSAdapterManager.java (working copy) @@ -582,7 +582,9 @@ Set contributorsToAppLevelAdapter = contributingAppClients.get(appName); if (contributorsToAppLevelAdapter == null) { contributorsToAppLevelAdapter = new HashSet(); - contributingAppClients.put(appName, contributorsToAppLevelAdapter); + Set tmpSet = contributingAppClients.putIfAbsent(appName, contributorsToAppLevelAdapter); + if(tmpSet != null) + contributorsToAppLevelAdapter = tmpSet; } contributorsToAppLevelAdapter.add(contributor); } Index: appclient/server/core/src/main/java/org/glassfish/appclient/server/core/jws/RestrictedContentAdapter.java =================================================================== --- appclient/server/core/src/main/java/org/glassfish/appclient/server/core/jws/RestrictedContentAdapter.java (revision 55241) +++ appclient/server/core/src/main/java/org/glassfish/appclient/server/core/jws/RestrictedContentAdapter.java (working copy) @@ -136,7 +136,7 @@ // return userFriendlyContextRoot; // } - public synchronized void addContentIfAbsent(final String relativeURIString, + public void addContentIfAbsent(final String relativeURIString, final StaticContent newContent) throws IOException { final StaticContent existingContent = content.get(relativeURIString); if (existingContent != null) { @@ -146,7 +146,9 @@ } return; } - this.content.put(relativeURIString, newContent); + StaticContent tmpNewContent = this.content.putIfAbsent(relativeURIString, newContent); + if(tmpNewContent != null) + newContent = tmpNewContent; this.cache.put(relativeURIString, newContent.file()); logger.fine(logPrefix() + "adding static content " + relativeURIString + " " + newContent.toString()); Index: web/web-core/src/main/java/org/apache/catalina/core/ApplicationContext.java =================================================================== --- web/web-core/src/main/java/org/apache/catalina/core/ApplicationContext.java (revision 55241) +++ web/web-core/src/main/java/org/apache/catalina/core/ApplicationContext.java (working copy) @@ -157,7 +157,7 @@ /** * The merged context initialization parameters for this Context. */ - private Map parameters = + private ConcurrentHashMap parameters = new ConcurrentHashMap(); private volatile boolean parametersMerged = false; @@ -479,20 +479,14 @@ */ public void removeAttribute(String name) { Object value = null; - boolean found = false; // Remove the specified attribute - synchronized (attributes) { - // Check for read only attribute - if (readOnlyAttributes.containsKey(name)) - return; - found = attributes.containsKey(name); - if (found) { - value = attributes.get(name); - attributes.remove(name); - } else { - return; - } + // Check for read only attribute + if (readOnlyAttributes.containsKey(name)) + return; + value = attributes.remove(name); + if (value == null) { + return; } // Notify interested application event listeners @@ -1032,7 +1026,7 @@ ApplicationParameter param = i.next(); if (param.getOverride()) { if (parameters.get(param.getName()) == null) - parameters.put(param.getName(), param.getValue()); + parameters.putIfAbsent(param.getName(), param.getValue()); } else { parameters.put(param.getName(), param.getValue()); } Index: web/web-core/src/main/java/org/apache/catalina/session/StandardSession.java =================================================================== --- web/web-core/src/main/java/org/apache/catalina/session/StandardSession.java (revision 55241) +++ web/web-core/src/main/java/org/apache/catalina/session/StandardSession.java (working copy) @@ -1939,8 +1939,10 @@ // END PWC 6444754 // Deserialize the attribute count and attribute values - if (attributes == null) - attributes = new ConcurrentHashMap(); + synchronized(attributes) { + if (attributes == null) + attributes = new ConcurrentHashMap(); + } /* PWC 6444754 int n = ((Integer) stream.readObject()).intValue(); */ Index: web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java =================================================================== --- web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java (revision 55241) +++ web/war-util/src/main/java/org/glassfish/web/loader/WebappClassLoader.java (working copy) @@ -1533,7 +1533,9 @@ Permission p = perms.next(); pc.add(p); } - loaderPC.put(codeUrl,pc); + PermissionCollection tmpPc = loaderPC.putIfAbsent(codeUrl,pc); + if(tmpPc != null) + pc = tmpPc; } } return (pc); Index: web/web-glue/src/main/java/com/sun/enterprise/web/logger/FileLoggerHandlerFactory.java =================================================================== --- web/web-glue/src/main/java/com/sun/enterprise/web/logger/FileLoggerHandlerFactory.java (revision 55241) +++ web/web-glue/src/main/java/com/sun/enterprise/web/logger/FileLoggerHandlerFactory.java (working copy) @@ -65,20 +65,22 @@ public void postConstruct() { } - public synchronized FileLoggerHandler getHandler(String logFile) { + public FileLoggerHandler getHandler(String logFile) { FileLoggerHandler handler = map.get(logFile); if (handler == null) { handler = new FileLoggerHandler(logFile); if (logFormatter != null) { handler.setFormatter(logFormatter); } - map.put(logFile, handler); + FileLoggerHandler tmpHandler = map.putIfAbsent(logFile, handler); + if(tmpHandler != null) + handler = tmpHandler; } return handler; } - public synchronized void removeHandler(String logFile) { + public void removeHandler(String logFile) { map.remove(logFile); } } Index: web/web-glue/src/main/java/com/sun/enterprise/web/ContextFacade.java =================================================================== --- web/web-glue/src/main/java/com/sun/enterprise/web/ContextFacade.java (revision 55241) +++ web/web-glue/src/main/java/com/sun/enterprise/web/ContextFacade.java (working copy) @@ -313,7 +313,10 @@ regis = (DynamicServletRegistrationImpl) createDynamicServletRegistrationImpl((StandardWrapper) wrapper); - servletRegisMap.put(servletName, regis); + DynamicServletRegistrationImpl tmpRegis = (DynamicServletRegistrationImpl) + servletRegisMap.putIfAbsent(servletName, regis); + if(tmpRegis != null) + regis = tmpRegis; servlets.put(servletName, className); } Index: common/amx-core-impl/src/main/java/org/glassfish/admin/amx/impl/mbean/PathnamesImpl.java =================================================================== --- common/amx-core-impl/src/main/java/org/glassfish/admin/amx/impl/mbean/PathnamesImpl.java (revision 55241) +++ common/amx-core-impl/src/main/java/org/glassfish/admin/amx/impl/mbean/PathnamesImpl.java (working copy) @@ -158,7 +158,9 @@ if (objectName != null) { //cdebug( "Matched " + path + " to " + objectName); - mPathnameCache.put(path, objectName); + ObjectName tmpObjectName = mPathnameCache.putIfAbsent(path, objectName); + if(tmpObjectName != null) + objectName = tmpObjectName; } return objectName; Index: common/amx-core/src/main/java/org/glassfish/admin/amx/core/proxy/ProxyFactory.java =================================================================== --- common/amx-core/src/main/java/org/glassfish/admin/amx/core/proxy/ProxyFactory.java (revision 55241) +++ common/amx-core/src/main/java/org/glassfish/admin/amx/core/proxy/ProxyFactory.java (working copy) @@ -431,7 +431,9 @@ info = getMBeanServerConnection().getMBeanInfo(objectName); if ( invariantMBeanInfo(info) ) { - mMBeanInfoCache.put(objectName, info); + MBeanInfo tmpInfo = mMBeanInfoCache.putIfAbsent(objectName, info); + if(tmpInfo != null) + info = tmpInfo; } } return info; Index: common/amx-core/src/main/java/org/glassfish/admin/amx/base/MBeanTracker.java =================================================================== --- common/amx-core/src/main/java/org/glassfish/admin/amx/base/MBeanTracker.java (revision 55241) +++ common/amx-core/src/main/java/org/glassfish/admin/amx/base/MBeanTracker.java (working copy) @@ -197,18 +197,17 @@ if ( parent != null ) { - synchronized(this) + mChildParent.put(child, parent); + Set children = mParentChildren.get(parent); + if ( children == null ) { - mChildParent.put(child, parent); - Set children = mParentChildren.get(parent); - if ( children == null ) - { - children = new HashSet(); - mParentChildren.put(parent, children); - } - children.add(child); - //debug( "MBeanTracker: ADDED " + child + " with parent " + parent ); + children = new HashSet(); + Set tmpChildren = mParentChildren.putIfAbsent(parent, children); + if(tmpChildren != null) + children = tmpChildren; } + children.add(child); + //debug( "MBeanTracker: ADDED " + child + " with parent " + parent ); } } Index: ejb/ejb-container/src/main/java/com/sun/ejb/containers/ReadOnlyBeanContainer.java =================================================================== --- ejb/ejb-container/src/main/java/com/sun/ejb/containers/ReadOnlyBeanContainer.java (revision 55241) +++ ejb/ejb-container/src/main/java/com/sun/ejb/containers/ReadOnlyBeanContainer.java (working copy) @@ -99,7 +99,7 @@ private DistributedReadOnlyBeanService distributedReadOnlyBeanService; - private volatile Map finderResultsCache = + private volatile ConcurrentHashMap finderResultsCache = new ConcurrentHashMap(); private static final int FINDER_LOCK_SIZE = 8 * 1024; @@ -550,18 +550,18 @@ hashCode = -hashCode; } int index = hashCode & (FINDER_LOCK_SIZE - 1); - synchronized (finderLocks[index]) { - value = finderResultsCache.get(key); - if (value == null) { - returnValue = super.invokeTargetBeanMethod( - beanClassMethod, inv, target, params, mgr); - finderResultsCache.put(key, new FinderResultsValue(returnValue, - currentTimeInMillis)); + value = finderResultsCache.get(key); + if (value == null) { + returnValue = super.invokeTargetBeanMethod( + beanClassMethod, inv, target, params, mgr); + FinderResultsValue tmpValue = finderResultsCache.putIfAbsent(key, new FinderResultsValue(returnValue, + currentTimeInMillis)); + if(tmpValue != null) + value = tmpValue; } else { - returnValue = value.value; - } - } - } + returnValue = value.value; + } + } } else { returnValue = super.invokeTargetBeanMethod(beanClassMethod, inv, Index: jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/core/EndpointRegistry.java =================================================================== --- jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/core/EndpointRegistry.java (revision 55241) +++ jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/core/EndpointRegistry.java (working copy) @@ -90,7 +90,9 @@ Map map= (Map)endpoints.get(service); if(map == null) { map = new Hashtable(); - endpoints.put(service, map); + Map tmpMap = (Map)endpoints.putIfAbsent(service, map); + if(tmpMap != null) + map = tmpMap; } map.put(endpointName, endpoint); Index: jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/bridge/transport/NMRClientConnection.java =================================================================== --- jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/bridge/transport/NMRClientConnection.java (revision 55241) +++ jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/bridge/transport/NMRClientConnection.java (working copy) @@ -131,7 +131,9 @@ EndpointMetaData emd = emdCache.get(key); if(emd == null) { emd = createEndpointMetaData(); - emdCache.put(key, emd); + EndpointMetaData tmpEmd = emdCache.putIfAbsent(key, emd); + if(tmpEmd != null) + emd = tmpEmd; } return emd; } Index: jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/util/soap/MessageExchangeHelper.java =================================================================== --- jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/util/soap/MessageExchangeHelper.java (revision 55241) +++ jbi/serviceengine/sun-javaee-engine/src/main/java/com/sun/enterprise/jbi/serviceengine/util/soap/MessageExchangeHelper.java (working copy) @@ -528,7 +528,9 @@ EndpointMetaData emd = wsdlCache.get(wsdlPath); if(emd == null) { emd = createEndpointMetaData(wsdlPath, serviceName, epName); - wsdlCache.put(wsdlPath, emd); + EndpointMetaData tmpEmd = wsdlCache.putIfAbsent(wsdlPath, emd); + if(tmpEmd != null) + emd = tmpEmd; } return emd; } Index: connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolManagerImpl.java =================================================================== --- connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolManagerImpl.java (revision 55241) +++ connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/PoolManagerImpl.java (working copy) @@ -469,10 +469,7 @@ if (_logger.isLoggable(Level.FINE)) { _logger.fine("Removing pool " + pool + " from pooltable"); } - synchronized (poolTable) { - poolTable.remove(poolInfo); - - } + poolTable.remove(poolInfo); if (listener != null){ listener.poolDestroyed(poolInfo); }