KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > perseus > cache > api > CacheAttributeController


1 /**
2  * Copyright (C) 2001-2002
3  * - France Telecom R&D
4  * - Laboratoire Logiciels, Systemes, Reseaux - UMR 5526, CNRS-INPG-UJF
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  * Release: 1.0
21  *
22  * Authors:
23  *
24  */

25
26 package org.objectweb.perseus.cache.api;
27
28 import org.objectweb.fractal.api.control.AttributeController;
29
30 import java.util.Collection JavaDoc;
31
32 /**
33  * This interface is management-related. Application code should
34  * not use this interface. Further, this interface is intended to be
35  * used by service tuning through Ping provided tools.
36  *
37  * This is the first draft for the this interface and it is likely to
38  * evolve.
39  *
40  * @author Luciano Garcia-Banuelos (Luciano.Garcia@imag.fr)
41  */

42 public interface CacheAttributeController extends AttributeController {
43
44     public final static int NO_LIMIT = -1;
45
46     /**
47      * This method allows to set the maximum number of objects to be
48      * held by the cache manager. However, the actual capacity of
49      * the cache depends on the Java Virtual Machine memory limits
50      * (and eventually by the amount of disk allocated).
51      * That is, if the application allocates a lot of large objects,
52      * and the memory limit is reached, the cache would not be able
53      * to hold more objects.
54      *
55      * The cache replacement task is launched when the maximum number
56      * of objects limit is nearly to be reached.
57      *
58      * @param size The maximum number of objects to be held in cache.
59      * (It must be a positive number).
60      *
61      * @exception IllegalArgumentException if the size is invalid (e.g. negative).
62      * @exception CacheException if it is not possible to reduce the cache size
63      * because all entries are fixed.
64      */

65     void setMaxObjects(int size) throws IllegalArgumentException JavaDoc, CacheException;
66
67     /**
68      * This method retrieves the maximum number of objects to be held by the
69      * cache.
70      */

71     int getMaxObjects();
72
73     /**
74      * This method allows to set the maximum main-memory size
75      * allocated to the cache. The size is limited by the actual
76      * amount of memory allocated to the Java Virtual Machine.
77      *
78      * @param size The maximum memory size.
79      * (It must be a positive number).
80      *
81      * @exception IllegalArgumentException if the size is invalid (e.g. negative).
82      */

83     void setMemorySize(int size) throws IllegalArgumentException JavaDoc;
84
85     /**
86      * This method returns the maximum main-memory size
87      * allocated to the cache.
88      */

89     int getMemorySize();
90
91     /**
92      * Assignes the number of element which can be removed when the cache is
93      * full. This value can be an absolute value( ex: "124") or a percent of the
94      * maximal cache size ("8%").
95      */

96     void setAutoCleanSize(String JavaDoc size);
97
98     String JavaDoc getAutoCleanSize();
99
100     /**
101      * Assignes the cache size value since the cache try to decrease the number
102      * of entries. This value can be an absolute value( ex: "124") or a percent
103      * of the maximal cache size ("8%").
104      */

105     void setAutoCleanThreshold(String JavaDoc size);
106
107     String JavaDoc getAutoCleanThreshold();
108
109     /**
110      * @return an positive integer value. It is the current size of the cache
111      * in term of object number currently managed by the cache.
112      */

113     int getCurrentSize();
114
115     /**
116      * @return an positive integer value. It is the current size of the cache
117      * in octets. This size matches to the memory foot print of the entries set
118      * managed by the cache.
119      */

120     int getCurrentMemorySize();
121
122     /**
123      * @return an unmodifiable collection containing the identifiers of current
124      * cache entries.
125      */

126     Collection JavaDoc getCurrentEntryIdentifiers();
127 }
128
Popular Tags