KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > containers > util > cache > UnboundedEJBObjectCache


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.ejb.containers.util.cache;
25
26 import com.sun.appserv.util.cache.Cache;
27 import com.sun.appserv.util.cache.CacheListener;
28 import com.sun.appserv.util.cache.Constants;
29
30 import java.util.Map JavaDoc;
31 import java.util.HashMap JavaDoc;
32 import java.util.Properties JavaDoc;
33 import java.util.ResourceBundle JavaDoc;
34
35 /**
36  * An EJB(Local)Object cache that does not impose any limit on the
37  * number of entries
38  *
39  * @author Mahesh Kannan
40  */

41 public class UnboundedEJBObjectCache
42     extends BaseCache
43     implements EJBObjectCache
44 {
45     /**
46      * default constructor
47      */

48     public UnboundedEJBObjectCache(String JavaDoc name) { super(); }
49     
50     /**
51      * constructor with specified timeout
52      */

53     public UnboundedEJBObjectCache(String JavaDoc name, long timeout) {
54         super();
55     }
56     
57     public void init(int maxEntries, int numberOfVictimsToSelect,
58             long timeout, float loadFactor, Properties JavaDoc props)
59     {
60         super.init(maxEntries, loadFactor, props);
61     }
62     
63     public Object JavaDoc get(Object JavaDoc key, boolean incrementRefCount) {
64         return super.get(key);
65     }
66     
67     public Object JavaDoc put(Object JavaDoc key, Object JavaDoc value, boolean linkWithLru) {
68         return super.put(key, value);
69     }
70     
71     public Object JavaDoc remove(Object JavaDoc key, boolean decrementRefCount) {
72         return super.remove(key);
73     }
74     
75     public void setEJBObjectCacheListener(EJBObjectCacheListener listener) {
76         //do nothing
77
}
78     
79     protected void trimItem(CacheItem item) {
80         
81     }
82     
83     public Map JavaDoc getStats() {
84         Map JavaDoc map = new HashMap JavaDoc();
85         StringBuffer JavaDoc sbuf = new StringBuffer JavaDoc();
86         sbuf.append("(listSize = 0")
87         .append("; cacheSize = ").append(getEntryCount())
88         .append(")");
89         map.put("_UnBoundedEJBObject ==> ", sbuf.toString());
90         return map;
91     }
92     
93 }
94
Popular Tags