Hello I guess you are suggesting to compile this class with the changes you propose and test it?
regards, marko On Thu, Nov 21, 2013 at 1:58 AM, David Bullock < david.bull...@machaira.com.au> wrote: > Oh, and 'throw e;' at the end of the handler :-) > David Bullock > Machaira Enterprises Pty Ltd > > PO Box 31 > Canowindra NSW 2804 > > 02 6344 1100 > http://machaira.com.au/ > > > On 21 November 2013 11:48, David Bullock <david.bull...@machaira.com.au> > wrote: > > Line 150 of org.apache.tomcat.jdbc.pool.FairBlockingQueue can throw > > InterruptedException, which should be handled by: > > > > catch (InterruptedException e) { > > lock.lock(); > > waiters.remove(c); // prevent future threads from offering to this > > thread, since we are about to die > > lock.unlock(); > > if (c.getCount() == 0) { // was given a connection between > > // when the exception was thrown we > acquired > > // the lock. This seems unlikely, > so we are > > // happy to have let go of the > > lock and re-acquire > > // if necessary > > lock.lock(); > > items.addFirst(c.getItem()); // return to the head of the > > queue, as per policy in offer() > > lock.unlock(); > > } > > } > > > > You're welcome. > > > > cf > http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java?revision=1432842&view=markup > > > > public E poll(long timeout, TimeUnit unit) throws InterruptedException { > > 135 E result = null; > > 136 final ReentrantLock lock = this.lock; > > 137 try { > > 138 //acquire the global lock until we know what to do > > 139 lock.lock(); > > 140 //check to see if we have objects > > 141 result = items.poll(); > > 142 if (result==null && timeout>0) { > > 143 //the queue is empty we will wait for an object > > 144 ExchangeCountDownLatch<E> c = new > > ExchangeCountDownLatch<>(1); > > 145 //add to the bottom of the wait list > > 146 waiters.addLast(c); > > 147 //unlock the global lock > > 148 lock.unlock(); > > 149 //wait for the specified timeout > > 150 if (!c.await(timeout, unit)) { > > 151 //if we timed out, remove ourselves from the > waitlist > > 152 lock.lock(); > > 153 waiters.remove(c); > > 154 lock.unlock(); > > 155 } > > 156 //return the item we received, can be null if we > timed out > > 157 result = c.getItem(); > > 158 } else { > > 159 //we have an object, release > > 160 lock.unlock(); > > 161 } > > 162 } finally { > > 163 if (lock.isHeldByCurrentThread()) { > > 164 lock.unlock(); > > 165 } > > 166 } > > 167 return result; > > 168 } > > David Bullock > > Machaira Enterprises Pty Ltd > > > > PO Box 31 > > Canowindra NSW 2804 > > > > 02 6344 1100 > > http://machaira.com.au/ > > > > > > On 21 November 2013 04:58, Christopher Schultz > > <ch...@christopherschultz.net> wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- > >> Hash: SHA256 > >> > >> Marko, > >> > >> On 11/20/13, 12:07 PM, marko lugarič wrote: > >>> I have repeated the test with logAbandoned set to "true" and left > >>> it half hour after pool is empty. There are a lot of exceptions > >>> (Pool empty. Unable to fetch a connection in 15 seconds and Pool > >>> wait interrupted) but i don't know what exactly to search (search > >>> with Abandoned did not produce anything). I have already tried > >>> using StatementFinalizer interceptor but it did not do anything to > >>> prevent pool from being empty. > >> > >> Can you work-up a simple testcase webapp and load test to reproduce > >> this problem? If so, please file a bug against tomcat-pool in Bugzilla > >> and attach the simple webapp and test harness. > >> > >> - -chris > >> -----BEGIN PGP SIGNATURE----- > >> Version: GnuPG v1.4.15 (Darwin) > >> Comment: GPGTools - http://gpgtools.org > >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > >> > >> iQIcBAEBCAAGBQJSjPhBAAoJEBzwKT+lPKRYQxIQAMHi+9z9jCbzulHiXns/Mt3p > >> J6w6K6nFCbDOgj7noYfwGf2eBINPQ77ywhF56pzBgn6v2wXWG21NRXTLfHxJJM/s > >> i1Ol9qp9mEUz3gmcumHbXU+RBBn1CbSh6D8cdVZDsX6tGF4BuzNtseZ0PRq7ZI5A > >> fi6dyPA5sZf1skfHIOBhmWT7VB7UGud03YmxnKhe3e7N2ZtDN2AJYNhU0haSHd1m > >> 1DGlCYxmMlK5mbqRA3RGWFTrnDmEvhBnSTLJaLywAojN8XHnNAH4fx4+MCT5GXrV > >> h1EL1PhvFnpbQ5haTOHNIwCNtW3OPwdLsXXVimOVF6UvEZepF3pDJUL0KVV+Kfem > >> p+r5BjkcjZ7LYirDBPFCsIovSwFcLrLScPUKbDHhF0Re5E7K7EtXuVuGGCJqWRsf > >> 8w8Z2pcyBIhX85+D+kBZ2m6MFODXnEqTQeGbFhzffuPXV/DuvipARpFg9s8uo1ws > >> 85NEtFzHjNblgxVxFaEgbbWulKT1ZNZerAMRnGDh9W2ngMjwYuQfevbJghUkM5b4 > >> nMc/aNU2mg10lneRwTUIJ0f/aGfiCQegjSSEYGIDi1LcDHDkI4GPmMz3gGIfItBs > >> yBEWXKn8aqVqVEVKjFzq5tD0kw9zyCEErYJH6N7o0HYmHHYfPxgz5Cr8gnnayUac > >> Ru2Z7Ur1lnZZnC72oUwz > >> =bJFf > >> -----END PGP SIGNATURE----- > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > >> For additional commands, e-mail: users-h...@tomcat.apache.org > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >