[
https://issues.apache.org/jira/browse/POOL-361?focusedWorklogId=280188&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-280188
]
ASF GitHub Bot logged work on POOL-361:
---------------------------------------
Author: ASF GitHub Bot
Created on: 21/Jul/19 23:37
Start Date: 21/Jul/19 23:37
Worklog Time Spent: 10m
Work Description: coveralls commented on issue #23: Move validation for
newly created objects into create(). Fixes POOL-361.
URL: https://github.com/apache/commons-pool/pull/23#issuecomment-513597437
[](https://coveralls.io/builds/24706376)
Coverage increased (+0.1%) to 85.349% when pulling
**ee452c3c836aaf044eaef069d8951443add665c4 on psteitz:master** into
**ef7364f803942529c7694372d4cf5d3179a08a18 on apache:master**.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 280188)
Time Spent: 20m (was: 10m)
> setTestOnCreate does not test on create
> ---------------------------------------
>
> Key: POOL-361
> URL: https://issues.apache.org/jira/browse/POOL-361
> Project: Commons Pool
> Issue Type: Bug
> Affects Versions: 2.6.1
> Reporter: Pablo
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> When setting testOnCreate to true, I would expect for the validation to take
> place when an object is created, but apparently it does not.
> It only seems to be tested on borrow and when idle.
> This has a negative impact, because when new objects get created, since they
> are not tested they appear in the pool as idle.
> I'm trying to determine if the pool's health, but even though the pool
> reports idle objects they are botched instances.
> Also related to this issue, objects aren't actually created upfront. They
> seem to be created on first borrow or when timeBetweenEvictionRunMillis
> elapses.
> Environment (unimportant I think): 1.8.0_191, Ubuntu 18.04
> Test case:
>
> {code:java}
> public static void main(String[] args) throws Exception {
> PooledObjectFactory<String> factory = new
> BasePooledObjectFactory<String>() {
> public String create() throws Exception {
> String s = "Hello";
> System.out.println("Creating " + s);
> return s;
> }
> public void destroyObject(PooledObject<String> p) throws
> Exception {
> System.out.println("Destroying " + p.getObject());
> }
> public boolean validateObject(PooledObject<String> p) {
> System.out.println("Validating " + p.getObject());
> return super.validateObject(p);
> }
> public PooledObject<String> wrap(String obj) {
> return new Wrapper<String>(obj);
> }
> };
> GenericObjectPoolConfig<String> socketPoolConfig = new
> GenericObjectPoolConfig<String>();
> socketPoolConfig.setTestOnCreate(true);
> socketPoolConfig.setTestWhileIdle(false);
> GenericObjectPool<String> objectPool = new
> GenericObjectPool<String>(factory, socketPoolConfig);
> System.out.println("Pool created");
> String f1 = objectPool.borrowObject();
> System.out.println("Borrowed" + f1);
> objectPool.returnObject(f1);
> objectPool.close();
> System.out.println("Done");
> }{code}
>
>
> Expected result:
> {{ Pool created}}
> {{ Creating Hello}}
> {{ *Validating Hello*}}
> {{ Allocating Hello}}
> {{ BorrowedHello}}
> {{ DeallocatingHello}}
> {{ Destroying Hello}}
> {{ Done}}
>
> Actual result:
> {{ Pool created}}
> {{ Creating Hello}}
> {{ Allocating Hello}}
> {{ *Validating Hello*}}
> {{ BorrowedHello}}
> {{ DeallocatingHello}}
> {{ Destroying Hello}}
> {{ Done}}
>
> Or am I misunderstanding something?
>
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)