Package com.volantis.cache.group

Examples of com.volantis.cache.group.GroupBuilder


        builder.setExpirationChecker(expirationCheckerMock);
        builder.setMaxCount(2);
        builder.setObjectProvider(providerMock);
        InternalCache cache = (InternalCache) builder.buildCache();

        GroupBuilder groupBuilder = factory.createGroupBuilder();
        groupBuilder.setMaxCount(2);

        clockMock.expects.getCurrentTime().returns(Time.inMilliSeconds(2000));

        final Group root = cache.getRootGroup();
        final Group other = root.addGroup("group1", groupBuilder);
View Full Code Here


        });
        final InternalCache cache = (InternalCache) builder.buildCache();

        // Create 7 groups, of size 4,8,12,16,20,24,28 with two subgroups
        // one of which is 50% and one is 75% of the size of the parent group.
        GroupBuilder groupBuilder = factory.createGroupBuilder();
        Group rootGroup = cache.getRootGroup();
        for (int i = 0, g = 0; i < 7; i += 1) {
            int maxCount = i * GROUP_SIZE_MULTIPLE + 4;
            groupBuilder.setMaxCount(maxCount);
            Group group = rootGroup.addGroup("group" + i, groupBuilder);
            groups[g++] = group;

            for (int s = 0; s < 2; s += 1) {
                groupBuilder.setMaxCount((int) ((0.5 + s / 4.0) * maxCount));
                groups[g++] = group.addGroup("group" + i + "/" + s,
                        groupBuilder);
            }
        }

View Full Code Here

        // them.
        CacheFactory factory = CacheFactory.getDefaultInstance();
        for (Iterator i = partitionList.iterator(); i.hasNext();) {
            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

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

     * @param maxCount   The size of the group.
     */
    public void addDefaultLocalPolicySpecificGroup(
            PolicyType policyType, int maxCount) {

        GroupBuilder groupBuilder = factory.createGroupBuilder();
        groupBuilder.setMaxCount(maxCount);

        // Add the group for the policy type to the local group.
        localDefaultGroup.addGroup(policyType, groupBuilder);
    }
View Full Code Here

            if (partitionSize < 1) {
                throw new IllegalStateException("Partition size must be >= 1");
            }

            CacheFactory cacheFactory = CacheFactory.getDefaultInstance();
            GroupBuilder groupBuilder = cacheFactory.createGroupBuilder();
            groupBuilder.setMaxCount(partitionSize);
            Group partitionGroup = baseGroup.addGroup(
                    configuration.getLocation(), groupBuilder);

            // Create the base constraints for the partition. These will
            // be used to derive the constraints for the type specific
            // partitions.
            CacheControlConstraints base =
                    new CacheControlConstraints(
                            partitionConstraints.getConstraints(),
                            partitionConfiguration);

            builder.setCacheControlDefaults(base.getDefaultCacheControl());

            SeparateCacheControlConstraintsMap constraintsMap =
                    new SeparateCacheControlConstraintsMap();
            for (Iterator i = PolicyType.getPolicyTypes().iterator(); i.hasNext();) {
                PolicyType policyType = (PolicyType) i.next();
                PolicyTypePartitionConfiguration typePartitionConfiguration =
                        partition.getTypePartition(policyType);
                CacheControlConstraints typeConstraints;
                groupBuilder = cacheFactory.createGroupBuilder();
                if (typePartitionConfiguration == null) {
                    typeConstraints = base;
                    groupBuilder.setMaxCount(partitionSize);
                } else {
                    RemotePolicyCacheConfiguration typeConfiguration =
                            typePartitionConfiguration.getConstraints();
                    if (typeConfiguration == null) {
                        typeConstraints = base;
                    } else {
                        typeConstraints = new CacheControlConstraints(base,
                                typeConfiguration);
                    }
                    groupBuilder.setMaxCount(typePartitionConfiguration.getSize());
                }
                partitionGroup.addGroup(policyType, groupBuilder);
                constraintsMap.addConstraints(policyType, typeConstraints);
            }
View Full Code Here

TOP

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

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.