01: package org.apache.turbine.util.pool;
02:
03: /*
04: * Copyright 2001-2005 The Apache Software Foundation.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License")
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
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 264148 2005-08-29 14:21:04Z henning $
25: */
26: public interface Recyclable {
27: /**
28: * Recycles the object for a new client. Recycle methods with
29: * parameters must be added to implementing object and they will be
30: * automatically called by pool implementations when the object is
31: * taken from the pool for a new client. The parameters must
32: * correspond to the parameters of the constructors of the object.
33: * For new objects, constructors can call their corresponding recycle
34: * methods whenever applicable.
35: * The recycle methods must call their super.
36: */
37: void recycle();
38:
39: /**
40: * Disposes the object after use. The method is called
41: * when the object is returned to its pool.
42: * The dispose method must call its super.
43: */
44: void dispose();
45:
46: /**
47: * Checks whether the recyclable has been disposed.
48: * @return true, if the recyclable is disposed.
49: */
50: boolean isDisposed();
51: }
|