Examples of PolicyCachePartitionConstraints


Examples of com.volantis.mcs.runtime.policies.cache.PolicyCachePartitionConstraints

            }
        } else {
            RemotePolicyCacheConfiguration partitionConfiguration =
                    partition.getConstraintsConfiguration();

            PolicyCachePartitionConstraints partitionConstraints;
            Group baseGroup;
            if (builder.isRemote()) {
                // The project is remote so use the group associated with the
                // remote partition if any, or the remote group.
                String location = configuration.getLocation();
                baseGroup = policyCache.getRemotePartitionGroup(location);
                if (baseGroup == null) {
                    baseGroup = policyCache.getRemoteGroup();
                }
                partitionConstraints =
                        policyCache.getRemotePartitionConstraints();
            } else {
                baseGroup = policyCache.getLocalGroup();
                partitionConstraints =
                        policyCache.getLocalPartitionConstraints();
            }

            int partitionSize = partitionConstraints.constrainPartitionSize(
                    partition.getSize());
            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 =
View Full Code Here

Examples of com.volantis.mcs.runtime.policies.cache.PolicyCachePartitionConstraints

                localSize, remoteSize);

        CacheControlConstraints localConstraints = createLocalCacheConstraints(
                Boolean.TRUE, null);

        PolicyCachePartitionConstraints localPartitionConstraints =
                createPartitionConstraints(localSize, localConstraints);

        builder.setLocalPartitionConstraints(localPartitionConstraints);

        PolicyCachePartitionConstraints remotePartitionConstraints =
                createPartitionConstraints(remoteSize, remoteConstraints);

        builder.setRemotePartitionConstraints(remotePartitionConstraints);

        // Now build the policy specific groups to the local group.
View Full Code Here

Examples of com.volantis.mcs.runtime.policies.cache.PolicyCachePartitionConstraints

        // The default partition size of a partition is 50% of the total
        // size of the partition, or a minimum of 1.
        int defaultPartitionSize = Math.max(totalSize / 2, 1);

        PolicyCachePartitionConstraints partitionConstraints
                = new PolicyCachePartitionConstraintsImpl(maxPartitionSize,
                        defaultPartitionSize, cacheControlConstraints);
        return partitionConstraints;
    }
View Full Code Here

Examples of com.volantis.mcs.runtime.policies.cache.PolicyCachePartitionConstraints

        configuration.setMaxTimeToLive(new Integer(200));
        configuration.setDefaultRetryInterval(new Integer(2));

        constraints = new CacheControlConstraints(configuration);

        PolicyCachePartitionConstraints partitionConstraints =
                new PolicyCachePartitionConstraintsImpl(50, 60, constraints);

        builder.setLocalPartitionConstraints(partitionConstraints);
        builder.setRemotePartitionConstraints(partitionConstraints);
        builder.addDefaultLocalPolicySpecificGroup(PolicyType.AUDIO, 5);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.