This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-pool.git
commit 2edd1fc546da70ec7508b3b83e4d516a185d5bf4 Author: Gary Gregory <[email protected]> AuthorDate: Mon Sep 14 13:23:17 2020 -0400 Add @SuppressWarnings. Better local var name. --- .../org/apache/commons/pool2/impl/GenericObjectPool.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java index 1a3a02b..7d182ab 100644 --- a/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java +++ b/src/main/java/org/apache/commons/pool2/impl/GenericObjectPool.java @@ -318,6 +318,7 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> * * @see AbandonedConfig */ + @SuppressWarnings("resource") // PrintWriter is managed elsewhere public void setAbandonedConfig(final AbandonedConfig abandonedConfig) { if (abandonedConfig == null) { this.abandonedConfig = null; @@ -1062,13 +1063,14 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> * Recovers abandoned objects which have been checked out but * not used since longer than the removeAbandonedTimeout. * - * @param ac The configuration to use to identify abandoned objects + * @param abandonedConfig The configuration to use to identify abandoned objects */ - private void removeAbandoned(final AbandonedConfig ac) { + @SuppressWarnings("resource") // PrintWriter is managed elsewhere + private void removeAbandoned(final AbandonedConfig abandonedConfig) { // Generate a list of abandoned objects to remove final long now = System.currentTimeMillis(); final long timeout = - now - (ac.getRemoveAbandonedTimeout() * 1000L); + now - (abandonedConfig.getRemoveAbandonedTimeout() * 1000L); final ArrayList<PooledObject<T>> remove = new ArrayList<>(); final Iterator<PooledObject<T>> it = allObjects.values().iterator(); while (it.hasNext()) { @@ -1086,8 +1088,8 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> final Iterator<PooledObject<T>> itr = remove.iterator(); while (itr.hasNext()) { final PooledObject<T> pooledObject = itr.next(); - if (ac.getLogAbandoned()) { - pooledObject.printStackTrace(ac.getLogWriter()); + if (abandonedConfig.getLogAbandoned()) { + pooledObject.printStackTrace(abandonedConfig.getLogWriter()); } try { invalidateObject(pooledObject.getObject(), DestroyMode.ABANDONED); @@ -1102,8 +1104,8 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T> @Override public void use(final T pooledObject) { - final AbandonedConfig ac = this.abandonedConfig; - if (ac != null && ac.getUseUsageTracking()) { + final AbandonedConfig abandonedCfg = this.abandonedConfig; + if (abandonedCfg != null && abandonedCfg.getUseUsageTracking()) { final PooledObject<T> wrapper = allObjects.get(new IdentityWrapper<>(pooledObject)); wrapper.use(); }
