Package com.sun.appserv.util.cache

Examples of com.sun.appserv.util.cache.BaseCache


            _logger = LogDomains.getLogger(LogDomains.WEB_LOGGER);
        }
        setLogLevel();

        //initialize sessions cache
        sessions = new BaseCache();
        sessions.init(_maxBaseCacheSize, _loadFactor, null);

        /*
        try {
          Logger.setLogWriter(new PrintWriter(
View Full Code Here


    /**
     * this method returns an array of cached session ids
     * @return String[] array of session ids
     */   
    private String[] getSessionIds() {
        BaseCache mainStoreCachedSessions = this.getMainStoreCache();
        String[] ids = null;
        int numberOfIds = mainStoreCachedSessions.getEntryCount();
        ArrayList idsList = new ArrayList(numberOfIds);
        Iterator keysIter = mainStoreCachedSessions.keys();
        while(keysIter.hasNext()) {
            //String nextKey = (String)keysIter.next();
            idsList.add((String)keysIter.next());
        }
        String[] template = new String[idsList.size()];
View Full Code Here

                            new ConfigChangeElement(nextKey, new Long(nextLastAccessTime));
                        keyList.add(nextElem);                           
                    }
                    rst.close();
                   
                    BaseCache mainStoreCachedSessions = this.getMainStoreCache();
                    for(int i=0; i<keyList.size(); i++) {
                        //get persistent values
                        ConfigChangeElement nextElem = (ConfigChangeElement)keyList.get(i);
                        String nextId = nextElem.getName();
                        long nextPersistentLastAccessTime = ((Long)nextElem.getValue()).longValue();
                        //get cached values
                        Session cachedSession = (Session)mainStoreCachedSessions.get(nextId);
                        long nextCachedLastAccessTime = ((StandardSession)cachedSession).getLastAccessedTimeInternal();
                        //if cached last access time is < persistent last access time
                        //then add to list of ids to remove from cache - it is stale
                        if(nextCachedLastAccessTime < nextPersistentLastAccessTime) {
                            staleIdList.add(nextId);
View Full Code Here

        return result;       
    }
   
    protected void removeSessionsForCache(String[] sessionIds) {
        HAManagerBase mgr = (HAManagerBase)this.getManager();
        BaseCache mainStoreCachedSessions = this.getMainStoreCache();
        synchronized(mainStoreCachedSessions) {
            for(int i=0; i<sessionIds.length; i++) {
                String nextId = sessionIds[i];
                StandardSession nextSess = null;
                try {
                    //SJSAS 6406580 START
                    //nextSess = (StandardSession)mgr.findSession(nextId);
                    nextSess = (StandardSession)mgr.findSessionFromCacheOnly(nextId);
                    //SJSAS 6406580 END                   
                } catch (IOException ex) {}               
                if(nextSess != null) {
                    //this should expire and fire the notifications
                    //but already removed from store
                    nextSess.expire(true, false);
                    // Take it out of the cache - remove does not handle nulls
                    if(nextId != null) {
                        mainStoreCachedSessions.remove(nextId);
                    }
                }               
            }
        }
    }      
View Full Code Here

        if (_debug > 0) {
            debug("in clear");
        }
        //System.out.println("IN NEW VERSION OF CLEAR");
        // Clear out the cache too
        sessions = new BaseCache();
        sessions.init(_maxBaseCacheSize, _loadFactor, null);       
       
        HADBConnectionGroup connGroup = null;
        try {
            connGroup = this.getConnectionsFromPool(true);
View Full Code Here

        // if it's in cache, it's in the store

        //get from the cache in the main store instance
        HAManagerBase mgr = (HAManagerBase)this.getManager();
        HAStore backgroundStore = (HAStore) mgr.getStore();
        BaseCache sesstbl = backgroundStore.getSessions();
        Session sess = (Session)sesstbl.get(session.getIdInternal());
        if ( sess != null ) {
          return true;
       

        //String existsSql = "SELECT id FROM " + storeTable + " WHERE id = ?";
View Full Code Here

    */   
    public void cleanup() {
        closeStatements();
        closeConnection();
        //this.setSessions(new Hashtable());
        this.setSessions(new BaseCache());
        sessions.init(_maxBaseCacheSize, _loadFactor, null);
    }
View Full Code Here

            debug("in clear");
        }

        //delete sessions for this app
        // Clear out the cache too
        sessions = new BaseCache();
        sessions.init(_maxBaseCacheSize, _loadFactor, null);

        String [] keys = keysSynchronized();
        for(int i=0; i<keys.length; i++) {
            //remove(keys[i]);
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

TOP

Related Classes of com.sun.appserv.util.cache.BaseCache

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.