1 package org.apache.turbine.util.pool; 2 3 /* 4 * Copyright 2001-2004 The Apache Software Foundation. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License") 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 /** 20 * An interface for objects that can be pooled and 21 * recycled several times by different clients. 22 * 23 * @author <a HREF="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a> 24 * @version $Id: Recyclable.java,v 1.4.2.2 2004/05/20 03:25:50 seade Exp $ 25 */ 26 public interface Recyclable 27 { 28 /** 29 * Recycles the object for a new client. Recycle methods with 30 * parameters must be added to implementing object and they will be 31 * automatically called by pool implementations when the object is 32 * taken from the pool for a new client. The parameters must 33 * correspond to the parameters of the constructors of the object. 34 * For new objects, constructors can call their corresponding recycle 35 * methods whenever applicable. 36 * The recycle methods must call their super. 37 */ 38 void recycle(); 39 40 /** 41 * Disposes the object after use. The method is called 42 * when the object is returned to its pool. 43 * The dispose method must call its super. 44 */ 45 void dispose(); 46 47 /** 48 * Checks whether the recyclable has been disposed. 49 * @return true, if the recyclable is disposed. 50 */ 51 boolean isDisposed(); 52 } 53