ASF Bugzilla – Attachment 29021 Details for
Bug 53498
Atomicity violation bugs because of misusing concurrent collections
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
The patch that may fix the atomicity violation bugs.
tomcat-7.0.28.patch (text/plain), 2.98 KB, created by
Yu Lin
on 2012-07-02 21:19:45 UTC
(
hide
)
Description:
The patch that may fix the atomicity violation bugs.
Filename:
MIME Type:
Creator:
Yu Lin
Created:
2012-07-02 21:19:45 UTC
Size:
2.98 KB
patch
obsolete
>Index: java/org/apache/catalina/core/ApplicationContext.java >=================================================================== >--- java/org/apache/catalina/core/ApplicationContext.java (revision 1355749) >+++ java/org/apache/catalina/core/ApplicationContext.java (working copy) >@@ -169,7 +169,7 @@ > /** > * The merged context initialization parameters for this Context. > */ >- private Map<String,String> parameters = >+ private ConcurrentHashMap<String,String> parameters = > new ConcurrentHashMap<String,String>(); > > >@@ -752,19 +752,14 @@ > public void removeAttribute(String name) { > > Object value = null; >- boolean found = false; >- >+ > // Remove the specified attribute > // Check for read only attribute > if (readOnlyAttributes.containsKey(name)) > return; >- found = attributes.containsKey(name); >- if (found) { >- value = attributes.get(name); >- attributes.remove(name); >- } else { >+ value = attributes.remove(name); >+ if(value == null) > return; >- } > > // Notify interested application event listeners > Object listeners[] = context.getApplicationEventListeners(); >@@ -1259,11 +1254,9 @@ > > @Override > public boolean setInitParameter(String name, String value) { >- if (parameters.containsKey(name)) { >+ if(parameters.putIfAbsent(name, value) != null) > return false; >- } >- >- parameters.put(name, value); >+ > return true; > } > >Index: java/org/apache/catalina/ha/context/ReplicatedContext.java >=================================================================== >--- java/org/apache/catalina/ha/context/ReplicatedContext.java (revision 1355749) >+++ java/org/apache/catalina/ha/context/ReplicatedContext.java (working copy) >@@ -168,8 +168,9 @@ > > @Override > public Object getAttribute(String name) { >- if (tomcatAttributes.containsKey(name) ) >- return tomcatAttributes.get(name); >+ Object obj = tomcatAttributes.get(name); >+ if (obj != null) >+ return obj; > else > return super.getAttribute(name); > } >Index: java/org/apache/catalina/startup/HostConfig.java >=================================================================== >--- java/org/apache/catalina/startup/HostConfig.java (revision 1355749) >+++ java/org/apache/catalina/startup/HostConfig.java (working copy) >@@ -146,7 +146,7 @@ > /** > * Map of deployed applications. > */ >- protected Map<String, DeployedApplication> deployed = >+ protected ConcurrentHashMap<String, DeployedApplication> deployed = > new ConcurrentHashMap<String, DeployedApplication>(); > > >@@ -1506,7 +1506,7 @@ > } else { > addWatchedResources(deployedApp, null, context); > } >- deployed.put(contextName, deployedApp); >+ deployed.putIfAbsent(contextName, deployedApp); > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 53498
: 29021