KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > excalibur > mpool > Resettable


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.excalibur.mpool;
18
19 /**
20  * This interface standardizes the behaviour of a resettable object.
21  * A resettable object is defined as an object that can be used to
22  * encapsulate another object without being altered by its content.
23  * Therefore, a resettable object may be reset and reused many times.
24  *
25  * This is helpful in cases where resettable objects are continously
26  * created and destroyed, causing a much greater amount of garbage to
27  * be collected by the JVM garbage collector. By making it resettable,
28  * it is possible to reduce the GC execution time, thus incrementing the
29  * overall performance of a process and decrementing the chance of
30  * memory overflow.
31  *
32  * Every implementation must provide their own method to allow this
33  * recyclable object to be reused by setting its content.
34  *
35  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
36  * @version CVS $Revision: 1.5 $ $Date: 2004/02/28 11:47:33 $
37  * @since 4.0
38  */

39 public interface Resettable
40 {
41     /**
42      * This method should be implemented to remove all costly resources
43      * in object. These resources can be object references, database connections,
44      * threads, etc. What is categorised as "costly" resources is determined on
45      * a case by case analysis.
46      */

47     void reset();
48 }
49
Popular Tags