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

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

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

--- Comment #2 from Yao Qi <qiyao...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to