001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018 package org.apache.commons.pool; 019 020 /** 021 * A base implementation of <code>PoolableObjectFactory</code>. 022 * <p> 023 * All operations defined here are essentially no-op's. 024 * 025 * @param <T> the type of objects held in this pool 026 * 027 * @see PoolableObjectFactory 028 * @see BaseKeyedPoolableObjectFactory 029 * 030 * @author Rodney Waldhoff 031 * @version $Revision: 1222388 $ $Date: 2011-12-22 13:28:27 -0500 (Thu, 22 Dec 2011) $ 032 * @since Pool 1.0 033 */ 034 public abstract class BasePoolableObjectFactory<T> implements PoolableObjectFactory<T> { 035 036 /** 037 * {@inheritDoc} 038 */ 039 public abstract T makeObject() throws Exception; 040 041 /** 042 * No-op. 043 * 044 * @param obj ignored 045 */ 046 public void destroyObject(T obj) 047 throws Exception { 048 } 049 050 /** 051 * This implementation always returns <tt>true</tt>. 052 * 053 * @param obj ignored 054 * @return <tt>true</tt> 055 */ 056 public boolean validateObject(T obj) { 057 return true; 058 } 059 060 /** 061 * No-op. 062 * 063 * @param obj ignored 064 */ 065 public void activateObject(T obj) throws Exception { 066 } 067 068 /** 069 * No-op. 070 * 071 * @param obj ignored 072 */ 073 public void passivateObject(T obj) 074 throws Exception { 075 } 076 }