[ https://issues.apache.org/jira/browse/POOL-409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17610101#comment-17610101 ]
Thomas Freller commented on POOL-409: ------------------------------------- Thank you for your enh. in dbcp2. I can confirm, that getConnection pool is now callable. If I use toString() i get the following output {code:java} 16:35:02.593 [main] INFO ssl_worker.SSL_Worker - Current DBPool Stats Active (current/max): 0/5 Idle (min/current/max): 0/0/0 GenericObjectPool [maxTotal=5, blockWhenExhausted=true, maxWaitDuration=PT-0.001S, lifo=true, fairness=false, testOnCreate=false, testOnBorrow=true, testOnReturn=false, testWhileIdle=false, durationBetweenEvictionRuns=PT10S, numTestsPerEvictionRun=3, minEvictableIdleTimeDuration=PT30S, softMinEvictableIdleTimeDuration=PT-0.001S, evictionPolicy=org.apache.commons.pool2.impl.DefaultEvictionPolicy@df6620a, closeLock=java.lang.Object@4e31276e, closed=false, evictionLock=java.lang.Object@1a72a540, evictor=org.apache.commons.pool2.impl.BaseGenericObjectPool$Evictor@27d5a580, evictionIterator=null, factoryClassLoader=java.lang.ref.WeakReference@198d6542, oname=null, creationStackTrace=java.lang.Exception at org.apache.commons.pool2.impl.BaseGenericObjectPool.<init>(BaseGenericObjectPool.java:409) at org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:147) at org.apache.commons.dbcp2.BasicDataSource.createObjectPool(BasicDataSource.java:588) at org.apache.commons.dbcp2.BasicDataSource.createConnectionPool(BasicDataSource.java:487) at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:539) at org.apache.commons.dbcp2.BasicDataSource.setLogWriter(BasicDataSource.java:2153) at db_pool.MySQLConPool.<init>(MySQLConPool.java:56) at ssl_worker.SSL_Worker.main(SSL_Worker.java:177) , borrowedCount=44, returnedCount=44, createdCount=44, destroyedCount=44, destroyedByEvictorCount=0, destroyedByBorrowValidationCount=0, activeTimes=StatsStore [[30, 40, 18, 8, 14, 21, 15, 15, 11, 13, 9, 11, 14, 12, 13, 17, 12, 14, 14, 13, 14, 25, 25, 13, 12, 11, 12, 12, 13, 16, 15, 10, 19, 9, 15, 13, 18, 14, 12, 16, 14039, 14025, 1, 5]], size=100, index=44], idleTimes=StatsStore [[1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 4]], size=100, index=44], waitTimes=StatsStore [[13, 13, 3, 4, 5, 5, 2, 7, 2, 2, 3, 3, 2, 2, 2, 12, 1, 2, 1, 1, 2, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 6, 14, 15, 6, 2, 9, 2, 3, 1, 3, 4, 4, 7]], size=100, index=44], maxBorrowWaitDuration=PT0.015S, swallowedExceptionListener=org.apache.commons.dbcp2.SwallowedExceptionLogger@5e403b4a, factoryType=null, maxIdle=0, minIdle=0, factory=org.apache.commons.dbcp2.PoolableConnectionFactory@5117dd67, allObjects={}, createCount=0, idleObjects=[], abandonedConfig=null] {code} Including a StackTrace in the Output. getStatsString() is protected and not callable but I could use the getters. Should we fix the toString or should I better use the getters and build my own string out of them? > BasicDataSource should support GenericObjectPool->getStatsString() > ------------------------------------------------------------------ > > Key: POOL-409 > URL: https://issues.apache.org/jira/browse/POOL-409 > Project: Commons Pool > Issue Type: Improvement > Affects Versions: 2.11.1 > Reporter: Thomas Freller > Priority: Major > Labels: improvement > Original Estimate: 2h > Remaining Estimate: 2h > > Hello, > I'm developing a Application that is running on a default JRE without an > Webserver/JMX. > For optimizing Database connections it would be very useful if i could access > > BasicDataSource->GenericObjectPool->{*}getStatsString(){*} > > I don't see any reason why this Method is protected and not public in > GenericObjectPool. > Then BasicDataSource shoud provide a method getStatsString() or the values > that represent the statistic data. > > If there is any other easy way to access this data within my Java Code I'll > implement this if you could give me an example how to get this working > easily. I don't want do configure any jmx stuff. > > > -- This message was sent by Atlassian Jira (v8.20.10#820010)