Package com.volantis.cache.group

Examples of com.volantis.cache.group.Group


        return group;
    }

    // Javadoc inherited.
    public Group findGroup(Object groupName) {
        Group group;
        synchronized (groupsMutex) {
            if (groups != null) {
                group = groups.getGroup(groupName);
            } else {
                group = null;
View Full Code Here


            snapshot = gatherer.getStatisticsSnapshot(this);
        } else {
            StatisticsGatherer combined = new StatisticsGatherer(gatherer);

            for (int i = 0; i < groups.size(); i++) {
                Group group = (Group) groups.get(i);
                StatisticsSnapshot nested = group.getStatisticsSnapshot();
                combined.addSnapshot(nested);
            }

            snapshot = combined.getStatisticsSnapshot(this);
        }
View Full Code Here

            for (int i = 0; i < 5000; i += 1) {

                try {
                    int v = offset + i;
                    int g = v % groups.length;
                    Group group = groups[g];
                    int k = (v / groups.length) % 13;
                    String keyText = "group" + g + ".key" + k;
                    keys.add(keyText);
                    Key key = new Key(keyText, k, group);

                    int choice = random.nextInt(100);
                    if (choice < 90) {
                        // 90% chance that it will retrieve an item from the
                        // cache.

                        if (logger.isDebugEnabled()) {
                            logger.debug("About to read entry with key '" + key + "'");
                        }

                        Object value = cache.retrieve(key);

                        if (logger.isDebugEnabled()) {
                            logger.debug("Read '" + value + "' with key '" +
                                                key + "'");
                        }

                    } else if (choice < 98) {
                        // 8% chance that it will remove an item.

                        if (logger.isDebugEnabled()) {
                            logger.debug("About to remove entry with key '" +
                                                key + "'");
                        }

                        cache.removeEntry(key);

                        if (logger.isDebugEnabled()) {
                            logger.debug("Removed entry with key '" + key + "'");
                        }
                    } else {
                        // 2% chance that it will flush a group.

                        if (logger.isDebugEnabled()) {
                            logger.debug("About to flush group " + g);
                        }

                        // Determine whether to flush even or odd keys.
                        final int evenOrOdd = random.nextInt(2);

                        // Select those keys with even indeces.
                        group.flush(new CacheEntryFilter() {
                            public boolean select(CacheEntry entry) {
                                Key key = (Key) entry.getKey();
                                return (key.getIndex() % 2 == evenOrOdd);
                            }
                        });
View Full Code Here

     * @throws SAXException if a problem occured in determining the state.
     */
    public CacheBodyOperationProcessState initializeProcessState()
            throws SAXException {

        final Group group = getCacheGroup();
        if (group != null) {
            this.recording = null;

            async = cache.asyncQuery(cacheKey, maxWaitTime);

View Full Code Here

     * exists in the cache.
     *
     * @return the cache group or null
     */
    private Group getCacheGroup() {
        Group group = null;
        if (cache != null) {
            group = cache.getRootGroup();
        }
        return group;
    }
View Full Code Here

            RemotePartitionsBuilder.Partition builderQuota =
                    (RemotePartitionsBuilder.Partition) i.next();
            GroupBuilder groupBuilder = factory.createGroupBuilder();
            groupBuilder.setMaxCount(builderQuota.getSize());
            String prefix = builderQuota.getPrefix();
            Group group = defaultRemoteGroup.addGroup(prefix,
                    groupBuilder);

            partitions.add(new RemotePartition(prefix, group));
        }
    }
View Full Code Here

            } else {
                policy = state.retrieveFailed(clock, expiredPolicy);
            }
        }

        Group group = cache.selectGroup(key, policy);

        // If there is a policy then never return the throwable as we are
        // retaining during retry and the caller wants to see the retained
        // policy not an exception. Otherwise if a throwable is set then throw
        // that.
View Full Code Here

        builder.setMaxCount(totalSize);
        builder.setExpirationChecker(new PolicyExpirationChecker());
        builder.setClock(clock);
        cache = builder.buildCache();

        Group root = getRootGroup();

        GroupBuilder groupBuilder;

        // Create the outermost local group.
        groupBuilder = factory.createGroupBuilder();
        groupBuilder.setMaxCount(localSize);

        localGroup = root.addGroup(PolicyCacheImpl.LOCAL_GROUP_KEY,
                groupBuilder);

        // Create the local default group. It has the same size as the
        // outermost one at the moment because there is no way to configure
        // it any differently.
        localDefaultGroup = localGroup.addGroup(
                PolicyCacheImpl.LOCAL_DEFAULT_GROUP_KEY, groupBuilder);

        // Create the outermost remote group.
        groupBuilder = factory.createGroupBuilder();
        groupBuilder.setMaxCount(remoteSize);

        remoteGroup = root.addGroup(PolicyCacheImpl.REMOTE_GROUP_KEY,
                groupBuilder);

        // Create the remote default group. It has the same size as the
        // outermost one at the moment because there is no way to configure
        // it any differently.
View Full Code Here

        delegate = cache;
        this.partitions = partitions;
        this.localPartitionConstraints = localPartitionConstraints;
        this.remotePartitionConstraints = remotePartitionConstraints;

        Group root = cache.getRootGroup();
        localGroup = root.getGroup(LOCAL_GROUP_KEY);
        localDefaultGroup = localGroup.getGroup(LOCAL_DEFAULT_GROUP_KEY);
        remoteGroup = root.getGroup(REMOTE_GROUP_KEY);
        remoteDefaultGroup = remoteGroup.getGroup(REMOTE_DEFAULT_GROUP_KEY);
    }
View Full Code Here

            RuntimeProject project,
            PolicyType policyType) {

        CacheEntryFilter filter = getFilter(policyType);

        Group group = project.getCacheGroup();
        group.flush(filter);
    }
View Full Code Here

TOP

Related Classes of com.volantis.cache.group.Group

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.