tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <Chuck.Caldar...@unisys.com>
Subject RE: Atomicity violation in removeAttribute
Date Mon, 27 Sep 2010 20:42:23 GMT
> From: ohad.shacham@gmail.com [mailto:ohad.shacham@gmail.com] On Behalf Of Ohad Shacham
> Subject: Re: Atomicity violation in removeAttribute

> I would use:

> if (attributes.containsKey(name)) {
>     value = attributes.remove(name);
>     if (value == null)
>         return;
> }
> else {
>     return;
> }

In what way is that an improvement?  ConcurrentHashMap.remove() returns null when the key
cannot be found; why add the redundant call to contansKey()?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message