You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "shengulong (via GitHub)" <gi...@apache.org> on 2025/06/06 03:00:45 UTC

[PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

shengulong opened a new pull request, #409:
URL: https://github.com/apache/commons-pool/pull/409

   <!--
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
     distributed with this work for additional information
     regarding copyright ownership.  The ASF licenses this file
     to you under the Apache License, Version 2.0 (the
     "License"); you may not use this file except in compliance
     with the License.  You may obtain a copy of the License at
   
       https://www.apache.org/licenses/LICENSE-2.0
   
     Unless required by applicable law or agreed to in writing,
     software distributed under the License is distributed on an
     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
     specific language governing permissions and limitations
     under the License.
   -->
   
   Thanks for your contribution to [Apache Commons](https://commons.apache.org/)! Your help is appreciated!
   
   Before you push a pull request, review this list:
   
   - [ ] Read the [contribution guidelines](CONTRIBUTING.md) for this project.
   - [ ] Run a successful build using the default [Maven](https://maven.apache.org/) goal with `mvn`; that's `mvn` on the command line by itself.
   - [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible but is a best-practice.
   - [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [ ] Each commit in the pull request should have a meaningful subject line and body. Note that commits might be squashed by a maintainer on merge.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

Posted by "shengulong (via GitHub)" <gi...@apache.org>.
shengulong commented on PR #409:
URL: https://github.com/apache/commons-pool/pull/409#issuecomment-2952635694

   That's OK


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

Posted by "shengulong (via GitHub)" <gi...@apache.org>.
shengulong commented on PR #409:
URL: https://github.com/apache/commons-pool/pull/409#issuecomment-2949626490

   @garydgregory 
   
   if maxWaitDuration is equal to 100s,
   
   for  the sentence:  remainingWaitDuration = remainingWaitDuration.minus(durationSince(startInstant));
   
   loop  remainingWaitDuration      cost time (notified by other thread before wait() timeout)       durationSince(startInstant)
    0           100s                                       10s                                                                0s
    1            100s-10s                               40s                                                               10s
    2           100s-10s-40s=50s               30s                                                               10s+40s
    3           100s-10s-40s-30s=20s       5s                                                               10s+40s+30s
    
   at the loop 2, the below condition will be true, and while loop is exited. It only cost 80s in while loop which is less than maxWaitDuration(100s)
   
   if (create == null
                       && remainingWaitDuration.compareTo(Duration.ZERO) > 0
                       && durationSince(localStartInstant).compareTo(remainingWaitDuration) >= 0) {
                   create = Boolean.FALSE;
               }


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #409:
URL: https://github.com/apache/commons-pool/pull/409#issuecomment-2952434162

   Ah, I see, the 3.x implementation is different from 2.x...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #409:
URL: https://github.com/apache/commons-pool/pull/409#issuecomment-2952437223

   @shengulong 
   
   I fixed this slightly differently to better match 2.x and 3.x (master). You are credited in `changes.xml`.
   
   Please verify and close this PR if your use case works.
   
   TY!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #409:
URL: https://github.com/apache/commons-pool/pull/409#issuecomment-2949113124

   Hello @shengulong 
   
   What does this fix and how? It would be best if you can provide a unit test that fails without changes to the `main` side of the source tree. Or at least explain it clearly.
   
   TY!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #409:
URL: https://github.com/apache/commons-pool/pull/409#issuecomment-2952435276

   See also https://issues.apache.org/jira/browse/POOL-422
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #409:
URL: https://github.com/apache/commons-pool/pull/409#issuecomment-2952385741

   Converting the table to GitHub markdown:
   
   | Step | Remaining Time        | Task Time | Accumulated Time     |
   |------|-----------------------|-----------|-----------------------|
   | 0    | 100s                  | 10s       | 0s                    |
   | 1    | 100s - 10s            | 40s       | 10s                   |
   | 2    | 100s - 10s - 40s = 50s| 30s       | 10s + 40s             |
   | 3    | 100s - 10s - 40s - 30s = 20s | 5s | 10s + 40s + 30s      |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [POOL-422] fix GenericObjectPool.create. [commons-pool]

Posted by "shengulong (via GitHub)" <gi...@apache.org>.
shengulong closed pull request #409: [POOL-422] fix GenericObjectPool.create.
URL: https://github.com/apache/commons-pool/pull/409


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org