001 package org.apache.fulcrum.pool; 002 003 004 /* 005 * Licensed to the Apache Software Foundation (ASF) under one 006 * or more contributor license agreements. See the NOTICE file 007 * distributed with this work for additional information 008 * regarding copyright ownership. The ASF licenses this file 009 * to you under the Apache License, Version 2.0 (the 010 * "License"); you may not use this file except in compliance 011 * with the License. You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, 016 * software distributed under the License is distributed on an 017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 018 * KIND, either express or implied. See the License for the 019 * specific language governing permissions and limitations 020 * under the License. 021 */ 022 023 024 /** 025 * An interface for objects that can be pooled and 026 * recycled several times by different clients. 027 * 028 * @author <a href="mailto:ilkka.priha@simsoft.fi">Ilkka Priha</a> 029 * @version $Id: Recyclable.java 535465 2007-05-05 06:58:06Z tv $ 030 */ 031 public interface Recyclable 032 { 033 /** 034 * Recycles the object for a new client. Recycle methods with 035 * parameters must be added to implementing object and they will be 036 * automatically called by pool implementations when the object is 037 * taken from the pool for a new client. The parameters must 038 * correspond to the parameters of the constructors of the object. 039 * For new objects, constructors can call their corresponding recycle 040 * methods whenever applicable. 041 * The recycle methods must call their super. 042 */ 043 public void recycle(); 044 045 /** 046 * Disposes the object after use. The method is called 047 * when the object is returned to its pool. 048 * The dispose method must call its super. 049 */ 050 public void dispose(); 051 052 /** 053 * Checks whether the recyclable has been disposed. 054 * @return true, if the recyclable is disposed. 055 */ 056 public boolean isDisposed(); 057 }