This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit a24dfb9ffc5e6f8e7886b3d7c726b0ceabd9d96c Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri Jun 17 14:01:45 2022 +0100 Remove unused code - Thanks to UCDetector --- MERGE.txt | 2 + .../dbcp/pool2/BaseKeyedPooledObjectFactory.java | 124 --------------------- .../tomcat/dbcp/pool2/BasePooledObjectFactory.java | 105 ----------------- .../dbcp/pool2/KeyedPooledObjectFactory.java | 1 - 4 files changed, 2 insertions(+), 230 deletions(-) diff --git a/MERGE.txt b/MERGE.txt index 0ee5ce424b..8404019433 100644 --- a/MERGE.txt +++ b/MERGE.txt @@ -62,12 +62,14 @@ Note: Tomcat's copy of fileupload also includes classes copied manually from DBCP ---- Pool2 +Unused classes removed Sub-tree src/main/java/org/apache/commons/pool2 The SHA1 ID / tag for the most recent commit to be merged to Tomcat is: rel/commons-pool-2.12.0 (2023-09-30) DBCP2 +No unused code removed Sub-tree src/main/java/org/apache/commons/dbcp2 src/main/resources/org/apache/commons/dbcp2 diff --git a/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java b/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java deleted file mode 100644 index a9877f12b6..0000000000 --- a/java/org/apache/tomcat/dbcp/pool2/BaseKeyedPooledObjectFactory.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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 - * - * http://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. - */ -package org.apache.tomcat.dbcp.pool2; - -/** - * A base implementation of {@code KeyedPooledObjectFactory}. - * <p> - * All operations defined here are essentially no-op's. - * </p> - * <p> - * This class is immutable, and therefore thread-safe. - * </p> - * - * @see KeyedPooledObjectFactory - * - * @param <K> The type of keys managed by this factory. - * @param <V> Type of element managed by this factory. - * - * @since 2.0 - */ -public abstract class BaseKeyedPooledObjectFactory<K, V> extends BaseObject - implements KeyedPooledObjectFactory<K, V> { - - /** - * Reinitialize an instance to be returned by the pool. - * <p> - * The default implementation is a no-op. - * </p> - * - * @param key the key used when selecting the object - * @param p a {@code PooledObject} wrapping the instance to be activated - */ - @Override - public void activateObject(final K key, final PooledObject<V> p) - throws Exception { - // The default implementation is a no-op. - } - - /** - * Create an instance that can be served by the pool. - * - * @param key the key used when constructing the object - * @return an instance that can be served by the pool - * - * @throws Exception if there is a problem creating a new instance, - * this will be propagated to the code requesting an object. - */ - public abstract V create(K key) - throws Exception; - - /** - * Destroy an instance no longer needed by the pool. - * <p> - * The default implementation is a no-op. - * </p> - * - * @param key the key used when selecting the instance - * @param p a {@code PooledObject} wrapping the instance to be destroyed - */ - @Override - public void destroyObject(final K key, final PooledObject<V> p) - throws Exception { - // The default implementation is a no-op. - } - - @Override - public PooledObject<V> makeObject(final K key) throws Exception { - return wrap(create(key)); - } - - /** - * Uninitialize an instance to be returned to the idle object pool. - * <p> - * The default implementation is a no-op. - * </p> - * - * @param key the key used when selecting the object - * @param p a {@code PooledObject} wrapping the instance to be passivated - */ - @Override - public void passivateObject(final K key, final PooledObject<V> p) - throws Exception { - // The default implementation is a no-op. - } - - /** - * Ensures that the instance is safe to be returned by the pool. - * <p> - * The default implementation always returns {@code true}. - * </p> - * - * @param key the key used when selecting the object - * @param p a {@code PooledObject} wrapping the instance to be validated - * @return always {@code true} in the default implementation - */ - @Override - public boolean validateObject(final K key, final PooledObject<V> p) { - return true; - } - - /** - * Wrap the provided instance with an implementation of - * {@link PooledObject}. - * - * @param value the instance to wrap - * - * @return The provided instance, wrapped by a {@link PooledObject} - */ - public abstract PooledObject<V> wrap(V value); -} diff --git a/java/org/apache/tomcat/dbcp/pool2/BasePooledObjectFactory.java b/java/org/apache/tomcat/dbcp/pool2/BasePooledObjectFactory.java deleted file mode 100644 index 3a309f4241..0000000000 --- a/java/org/apache/tomcat/dbcp/pool2/BasePooledObjectFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 - * - * http://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. - */ -package org.apache.tomcat.dbcp.pool2; - -/** - * A base implementation of {@code PoolableObjectFactory}. - * <p> - * All operations defined here are essentially no-op's. - * <p> - * This class is immutable, and therefore thread-safe - * - * @param <T> Type of element managed in this factory. - * - * @see PooledObjectFactory - * @see BaseKeyedPooledObjectFactory - * - * @since 2.0 - */ -public abstract class BasePooledObjectFactory<T> extends BaseObject implements PooledObjectFactory<T> { - - /** - * No-op. - * - * @param p ignored - */ - @Override - public void activateObject(final PooledObject<T> p) throws Exception { - // The default implementation is a no-op. - } - - /** - * Creates an object instance, to be wrapped in a {@link PooledObject}. - * <p>This method <strong>must</strong> support concurrent, multi-threaded - * activation.</p> - * - * @return an instance to be served by the pool - * - * @throws Exception if there is a problem creating a new instance, - * this will be propagated to the code requesting an object. - */ - public abstract T create() throws Exception; - - /** - * No-op. - * - * @param p ignored - */ - @Override - public void destroyObject(final PooledObject<T> p) - throws Exception { - // The default implementation is a no-op. - } - - @Override - public PooledObject<T> makeObject() throws Exception { - return wrap(create()); - } - - /** - * No-op. - * - * @param p ignored - */ - @Override - public void passivateObject(final PooledObject<T> p) - throws Exception { - // The default implementation is a no-op. - } - - /** - * Always returns {@code true}. - * - * @param p ignored - * - * @return {@code true} - */ - @Override - public boolean validateObject(final PooledObject<T> p) { - return true; - } - - /** - * Wraps the provided instance with an implementation of - * {@link PooledObject}. - * - * @param obj the instance to wrap - * - * @return The provided instance, wrapped by a {@link PooledObject} - */ - public abstract PooledObject<T> wrap(T obj); -} diff --git a/java/org/apache/tomcat/dbcp/pool2/KeyedPooledObjectFactory.java b/java/org/apache/tomcat/dbcp/pool2/KeyedPooledObjectFactory.java index d2455069d3..35a9842398 100644 --- a/java/org/apache/tomcat/dbcp/pool2/KeyedPooledObjectFactory.java +++ b/java/org/apache/tomcat/dbcp/pool2/KeyedPooledObjectFactory.java @@ -67,7 +67,6 @@ package org.apache.tomcat.dbcp.pool2; * </p> * * @see KeyedObjectPool - * @see BaseKeyedPooledObjectFactory * * @param <K> The type of keys managed by this factory. * @param <V> Type of element managed by this factory. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org