commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "rod (JIRA)" <>
Subject [jira] Created: (DBCP-189) [dbcp] Threads do not get a Connection in FIFO mode
Date Tue, 30 May 2006 13:49:31 GMT
[dbcp] Threads do not get a Connection in FIFO mode

         Key: DBCP-189
     Project: Commons Dbcp
        Type: Bug

    Versions: 1.2 Final    
 Environment: commons-dbcp-1.2.1.jar
    Reporter: rod

the SharedPoolDataSource class uses the class GenericKeyedObjectPool which has a FIFO behavior.
the problem is that when all connections in the pool are used, the synchronised method SharedPoolDataSource.getPooledConnectionAndInfo

calls the borrowObject() blocking method and does not release its monitor.
as a result, all other threads asking for a connection get blocked trying to get the monitor
and  will get a connection later in a non-FIFO mode.
i think the fix is to synchronized only the code block :
        if (pool == null) {
            try {
                registerPool(username, password);
            } catch (NamingException e) {
                throw new SQLNestedException("RegisterPool failed", e);
instead of synchronizing the whole method.


This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message