ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KwonNam Son" <kwon3...@gmail.com>
Subject About IBATIS-249 bug.
Date Mon, 29 May 2006 04:33:20 GMT
Hello,

I'm suffering from http://issues.apache.org/jira/browse/IBATIS-249 bug.
I download 2.1.7 source code from subversion repository, and patched it with
"http://issues.apache.org/jira/secure/attachment/12322370/IBATIS-249.diff"
file.
Then, I rebuild iBATIS, and upload to WAS.

But there is the SAME PROBLEM...

iBATIS stops when it runs Throttle.increment() (the line numbers are
deifferent from 2.1.7 source codes because of the patch).
----------------------------------------------------------------------------------------------------------------------------------------
    at com.ibatis.common.util.Throttle.increment(Throttle.java:70)
    - locked <d668f780> (a java.lang.Object)
    at com.ibatis.common.util.ThrottledPool.pop(ThrottledPool.java:57)

----------------------------------------------------------------------------------------------------------------------------------------

Throttle.java:70 is "LOCK.wait();", see the following snippet of
Throttle.java.(patched version)
----------------------------------------------------------------------------------------------------------------------------------------
      long totalWaitTime = 0;
      while (count >= limit) {
         if (maxWait > 0) {                                   <<--- Never
happend to be "maxWait >0"
           long waitTime = System.currentTimeMillis();
           try {
            LOCK.wait(maxWait - totalWaitTime);
           } catch (InterruptedException e) {
             //ignore
           }
          totalWaitTime += System.currentTimeMillis() - waitTime;
          if (totalWaitTime > maxWait) {
            throw new NestedRuntimeException("Throttle waited too long (" +
totalWaitTime + ") for lock.");
           }
         } else {
           try {
            LOCK.wait();                                         <<--- this
is line 70
          } catch (InterruptedException e) {
            //ignore
          }
        }
      }
      count++
----------------------------------------------------------------------------------------------------------------------------------------

"if (maxWait > 0)" is never happened,  see the ThrottledPool.java's line
number 41which creates Throttle object.

----------------------------------------------------------------------------------------------------------------------------------------
  public ThrottledPool(Class type, int size) {
    try {
      this.throttle = new Throttle(size);                     <<---  Does
NOT SET maxWait value.
      this.type = type;
      this.pool = Collections.synchronizedList(new ArrayList(size));
      for (int i=0; i < size; i++) {
        this.pool.add(type.newInstance());
      }
    } catch (Exception e) {
      throw new NestedRuntimeException("Error instantiating class.  Cause: "
+ e, e);
    }
  }
----------------------------------------------------------------------------------------------------------------------------------------

How can I set the maxWait value for Throttle Object??
Is this another bug? or is there any other solution??

Also, I hope iBATIS 2.1.7.1(maybe...) which is patched for iBATIS-249 bug to
be released.

Regards,
KwonNam.

Mime
View raw message