That was one of the problems uncovered. I fixed it by modifying the pool so all add/remove happens at "last" rather than "first".

The tests didn't find it because connections were never getting returned since the ConnectionEventListener wasn't installed.

thanks
david jencks

On Wednesday, April 7, 2004, at 04:00 PM, Hamilton Verissimo de Oliveira (Engenharia - SPO) wrote:

-----Mensagem original-----
De: David Jencks [mailto:[EMAIL PROTECTED]

I've modified your equals method but kept hashcode.  This uncovered
several other problems in the tests which I have fixed.

Please let me know if you find more problems.

Since you asked :-)

SinglePoolConnectionInterceptor.java:

In the returnConnection method:

Change

            synchronized (pool) {
                mci.setLastUsed(System.currentTimeMillis());
                                pool.addFirst(mci);
            }

to

            synchronized (pool) {
                mci.setLastUsed(System.currentTimeMillis());
                if (pool.isEmpty())
                {
                        pool.addLast(mci);
                }
                else
                {
                                pool.addFirst(mci);
                }
            }


When the pool is empty and you try to add the first connection it fails.
Strage that is not being catched in the test case.








Reply via email to