tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 48791] Race condition in class javax.el.BeanELResolver$BeanProperty field read/write
Date Tue, 02 Mar 2010 02:38:56 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=48791

Yao Qi <qiyaoltc@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qiyaoltc@gmail.com

--- Comment #2 from Yao Qi <qiyaoltc@gmail.com> 2010-03-02 02:38:55 UTC ---
(In reply to comment #1)
> It might be inefficient (although I doubt you'd notice it in any realistic
> test), it might be poor coding style (that is arguable) but it isn't a bug.
Can you explain a little bit why it isn't a bug?
If two threads access the following code,
255        private Method read(ELContext ctx) {
256            if (this.read == null) {
257              this.read = getMethod(this.owner,descriptor.getReadMethod());

The value of this.read will be either return value of getMethod invoked by two
threads.  Can we change it to this manner,

if (this.read == null) {
      synchronized (lock4Read){
           if (this.read == null){
             this.read = getMethod(this.owner,descriptor.getReadMethod());
           }
      }

This change is still efficient, and make sure no race in it.  How do you think?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


Mime
View raw message