use of com.sun.appserv.util.cache.LruCache in project Payara by payara.
the class ActiveTxCache method createReadyStore.
protected void createReadyStore(int cacheSize, int numberOfVictimsToSelect, float loadFactor, long idleTimeout) throws Exception {
idleTimeout = (idleTimeout <= 0) ? -1 : idleTimeout;
if (cacheSize <= 0 && idleTimeout <= 0) {
readyStore = new BaseCache();
cacheSize = DEFAULT_CACHE_SIZE;
readyStore.init(cacheSize, loadFactor, null);
} else {
cacheSize = (cacheSize <= 0) ? DEFAULT_CACHE_SIZE : cacheSize;
LruCache lru = new LruCache(DEFAULT_CACHE_SIZE);
if (numberOfVictimsToSelect >= 0) {
loadFactor = (float) (1.0 - (1.0 * numberOfVictimsToSelect / cacheSize));
}
lru.init(cacheSize, idleTimeout, loadFactor, null);
readyStore = lru;
readyStore.addCacheListener(this);
}
if (idleTimeout > 0) {
idleBeansPassivator = setupIdleBeansPassivator(readyStore);
}
}