You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/03/02 03:38:56 UTC

DO NOT REPLY [Bug 48791] Race condition in class javax.el.BeanELResolver$BeanProperty field read/write

https://issues.apache.org/bugzilla/show_bug.cgi?id=48791

Yao Qi <qi...@gmail.com> changed:

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

--- Comment #2 from Yao Qi <qi...@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