Package com.sun.appserv.util.cache

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


            throws IOException, ClassNotFoundException, BackingStoreException {
        /**
         * For the in-memory implementation, the restarted instance might
         * have the session in its replica cache, if the load-factor is used.
         */
        BaseCache replicaCache = getReplicaCache();
        if(replicaCache != null) {
            replicaCache.remove(id);
        }
        ReplicationState sessionState = loadSessionFromRemoteActiveCache(
                id, String.valueOf(expat.getVersion()), expat.getInstanceName());
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("ReplicationStore>>loadFromActiveCache:id="
View Full Code Here


            _logger.exiting("ReplicationSingleSignOn", "repairSave");
        }
    }

    public ReplicationState[] getReplicatedSsoEntriesArray() {
        BaseCache replicatedSSOEntriesCache = getReplicatedSSOEntries();
        ReplicationState[] ssoEntries = null;
        int numberOfIds = replicatedSSOEntriesCache.getEntryCount();
        ArrayList valuesList = new ArrayList(numberOfIds);
        Iterator valuesIter = replicatedSSOEntriesCache.values();
        while(valuesIter.hasNext()) {
            valuesList.add((ReplicationState)valuesIter.next());
        }
        ReplicationState[] template = new ReplicationState[valuesList.size()];
        ssoEntries = (ReplicationState[])valuesList.toArray(template);
View Full Code Here

    private HashSet<ExpatListElement> getHttpSessionExpatIdsFromReplica(
            String requestingInstance) {
        //using set to avoid dups
        HashSet expatIdsSet = new HashSet();
        //iterate over session replicas
        BaseCache replicatedSessionsCache = getReplicatedSessions();
        Iterator it = replicatedSessionsCache.values();
        long version = -1L;
        while (it.hasNext()) {
            ReplicationState state = (ReplicationState) it.next();
            String sId = (String) state.getId();
            //use bekey for mapping instance ownership
View Full Code Here

    /**
     * Get the HttpSession' expat list from the replica cache for all the surviving instances.
     */
    private void getHttpSessionExpatIdsFromReplica(ExpatListQueryResults results) {
        //iterate over session replicas
        BaseCache replicatedSessionsCache = getReplicatedSessions();
        Iterator it = replicatedSessionsCache.values();
        long version = -1L;
        while (it.hasNext()) {
            ReplicationState state = (ReplicationState) it.next();
            String ssId = (String) state.getId();
            //use bekey for mapping instance ownership
View Full Code Here

        }       
        this.putInReplicationCache(message);
    }
   
    public ReplicationState processSize(ReplicationState message) {
        BaseCache replicatedSessionsCache = getReplicatedSessions();
        int result = replicatedSessionsCache.getEntryCount();
        if(_logger.isLoggable(Level.FINE)) {
            _logger.fine("processSize: entryCount=" + result);
        }        
        ReplicationState resultState
            = ReplicationState.createQueryStateResponse(MODE_WEB, message.getAppId(), message.getAppId(), message.getInstanceName(), Integer.valueOf(result));
View Full Code Here

    public void processRemoveids(ReplicationState message) {
        if(_logger.isLoggable(Level.FINE)) {
            _logger.fine("IN" + this.getClass().getName() + ">>processRemoveids");
        }
        BaseCache replicatedSessionsCache = getReplicatedSessions();
        //state of this message contains serialized list of ids to remove
        byte[] idsToRemoveState = message.getState();
        List removedIdsList = new ArrayList();
        try {
            removedIdsList = (List)ReplicationState.getObjectValue(idsToRemoveState);
        } catch (Exception ex) {
            //deliberately do nothing
        }
        //ReplicationState.displayStringList(removedIdsList);
        for(int i=0; i<removedIdsList.size(); i++) {
            String nextIdToRemove = (String)removedIdsList.get(i);
            if(_logger.isLoggable(Level.FINE)) {
                _logger.fine(">>processRemoveids:nextIdToRemove=" + nextIdToRemove);
            }
            replicatedSessionsCache.remove(nextIdToRemove);
            }
        }
View Full Code Here

            = healthChecker.getReshapeReplicateFromInstanceName();
        if(replicatedFromInstanceName != null && replicatedFromInstanceName.equalsIgnoreCase(owningInstanceName)) {           
            return;          
        }       
        List idsToRemove = new ArrayList();
        BaseCache replicatedSessionsCache = getReplicatedSessions();
        Iterator it = replicatedSessionsCache.values();
        while(it.hasNext()) {
            ReplicationState nextState
                = (ReplicationState)it.next();
            byte[] extraParamsState
                = nextState.getContainerExtraParamsState();
View Full Code Here

    }

    public static int removeStaleReplicas(String reconcilingInstance,
                                           SessionStoreInterface storeInterface) {
        Set<String> replicasToBePurged = new HashSet<String>();
        BaseCache replicaCache = storeInterface.getReplicaCache();
        Iterator<ReplicationState> replicatedSessions = replicaCache.values();
        List lbEnabledList = getLbEnabledList();
        while (replicatedSessions.hasNext()) {
            ReplicationState replica = replicatedSessions.next();
            if (canRemoveReplica(replica, reconcilingInstance, lbEnabledList)) {
                replicasToBePurged.add((String) replica.getId());
View Full Code Here

                }
            }
            // If some other instance has failed during the rolling upgrade of an instance,
            // then we should take care of that.
            int reconciledFromReplica = 0;
            BaseCache replicaCache = storeInterface.getReplicaCache();
            Iterator<ReplicationState> replicatedSessions = replicaCache.values();
            List lbEnabledList = getLbEnabledList();
            while(replicatedSessions.hasNext()) {
                ReplicationState replica = replicatedSessions.next();
                String beKey = (String)replica.getProperty(ReplicationState.BEKEY);
                if(isRightfulOwner(reconilingInstance, beKey) &&
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.