commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernd Eckenfels (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (POOL-277) Monitor contention at BaseGenericObjectPool
Date Thu, 18 Sep 2014 12:34:33 GMT

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

Bernd Eckenfels commented on POOL-277:
--------------------------------------

I have already commented on the PR (at least getMean() should be getMax()). But I wonder if
the complicated queueing can be avoided with a lockless max alternative using AtomicLong like:

{code}
        do {
            currentMax = maxWaitTime.get();
            if (waitTime < currentMax)
                break;
        } while (!maxWaitTime.compareAndSet(currentMax, waitTime))
{code}

This asumes the if typically breaks the loop early (no new max) and a new max can have some
more actions as the system is slow in that case anyway. This totally avoids the additional
class and risky list maintenance.

> Monitor contention at BaseGenericObjectPool
> -------------------------------------------
>
>                 Key: POOL-277
>                 URL: https://issues.apache.org/jira/browse/POOL-277
>             Project: Commons Pool
>          Issue Type: Improvement
>    Affects Versions: 2.2
>            Reporter: Lucas Pouzac
>              Labels: concurrency, performance
>             Fix For: 2.3
>
>         Attachments: monitor_contention_basegenericobjectpool.png, monitor_contention_basegenericobjectpool_after_pull_request.png
>
>
> Updating JMX causes synchronization while the service is secondary. See screenshot.
> I create a Pull Request [#1|https://github.com/apache/commons-pool/pull/1].



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message