Package com.volantis.cache.impl

Examples of com.volantis.cache.impl.InternalCacheEntry


    }

    public Object perform(MethodActionEvent event)
            throws Throwable {

        InternalCacheEntry entry = (InternalCacheEntry)
                event.getArgument(CacheEntry.class);
        TestCaseAbstract.assertEquals(key, entry.getKey());
        TestCaseAbstract.assertEquals(value, entry.getValue());
        return null;
    }
View Full Code Here


        }

        // Keep looping around until the group no longer exceeds its limit.
        boolean purgeRequired;
        do {
            InternalCacheEntry entry = null;

            // Synchronize on the group to get an entry. The entry cannot be
            // removed at this point because in order to do that the code needs
            // to synchronize on the entry which must always be done before
            // synchronizing on the group's entry mutex.
            synchronized(entries) {

                // While inside this block the group entries cannot be modified
                // but nested groups may have removed entries and are blocking
                // waiting to update this group. This means that we may
                // purge entries that we do not strictly need to purge but that
                // is unavoidable. We may also not be able to find any entries
                // to purge in the nested groups, they may all be empty for
                // example. In that case we just loop around and try again.
                if (totalCount > maxCount) {
                    purgeRequired = true;

                    if (logger.isDebugEnabled()) {
                        logger.debug("Count " + totalCount + " max count " +
                                maxCount);
                    }

                } else {
                    purgeRequired = false;

                    if (logger.isDebugEnabled()) {
                        logger.debug("Purge no longer required");
                    }
                }
            }

            // If a purge was required and an entry to remove was found then
            // try and remove it.
            if (purgeRequired) {

                // Select the entry that is from the group with the highest
                // percentage usage and is the least recently used.
                entry = selectLeastRecentlyUsedEntry();

                if (entry != null) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Attempting to purge " + entry);
                    }

                    boolean removed = entry.removeFromCache(null);
                    if (logger.isDebugEnabled()) {
                        if (removed) {
                            logger.debug("Removed " + entry);
                        } else {
                            logger.debug("Failed to remove " + entry);
View Full Code Here

        // Select the group to prune, that is the group with the highest
        // percentage usage. This strategy is chosen because it should spread
        // the entries fairly across the groups in the cache. This method can
        // return the group passed in or one of its child groups.
        InternalGroup group = selectGroupWithHighestUsage();
        InternalCacheEntry entry;

        // If this group is the one with the highest usage then return the
        // entry that is least recently used.
        if (group == this) {
            entry = getLeastRecentlyUsedEntry();
View Full Code Here

        List entries = getEntries();

        // Iterate over the list of entries removing those entries that are
        // matched by the filter.
        for (Iterator i = entries.iterator(); i.hasNext();) {
            InternalCacheEntry entry = (InternalCacheEntry) i.next();
            entry.removeFromCache(filter);
        }
    }
View Full Code Here

            reporter.reportIssue("Expected count " + totalCount +
                    " actual count " + actualCount);
        }

        for (int i = 0; i < list.size(); i++) {
            InternalCacheEntry entry = (InternalCacheEntry) list.get(i);
            entry.performIntegrityCheck(this, reporter);
        }

        reporter.endChecking("Group " + description);
    }
View Full Code Here

        // Iterate over all the entries in this group itself.
        List list = new ArrayList();
        addEntries(list);

        for (int i = 0; i < list.size(); i++) {
            InternalCacheEntry entry = (InternalCacheEntry) list.get(i);
            entry.debugStructure(writer);
        }

        // Iterate over the nested groups validating them and getting a count
        // of all the entries in the group.
        List groups = getGroupList();
View Full Code Here

TOP

Related Classes of com.volantis.cache.impl.InternalCacheEntry

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.