[ 
https://issues.apache.org/jira/browse/AMQ-7131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16740329#comment-16740329
 ] 

Benjamin Graf commented on AMQ-7131:
------------------------------------

Actually thinking about this enhancement. Feels a bit odd.


{code:java}
while (connection == null) {
    try {
        connection = connectionsPool.borrowObject(key);
    } catch (NoSuchElementException ex) {
        if (!"Timeout waiting for idle object".equals(ex.getMessage())) {
            throw ex;
        }
    }
    if (connection != null) {
        synchronized (connection) {
            if (connection.getConnection() != null) {
                connection.incrementReferenceCount();
                break;
            }

            // Return the bad one to the pool and let if get destroyed as 
normal.
            connectionsPool.returnObject(key, connection);
            connection = null;
        }
    }
}
{code}


> ActiveMQ JMS pool has no borrow timeout causing starvation
> ----------------------------------------------------------
>
>                 Key: AMQ-7131
>                 URL: https://issues.apache.org/jira/browse/AMQ-7131
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: activemq-pool
>    Affects Versions: 5.15.8
>            Reporter: Benjamin Graf
>            Assignee: Benjamin Graf
>            Priority: Major
>
> A maxPoolSize of 1 can cause starvation during createConnection if the only 
> connection gets evicted concurrently since borrow method of pool has no 
> timeout waiting forever.
> Maybe introduce a new variable connectionTimeout with default 30000ms. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to