Package org.apache.stratos.cloud.controller.stub.deployment.partition

Examples of org.apache.stratos.cloud.controller.stub.deployment.partition.Partition


            for(int i=0; i < noOfPartitions; i++)
            {
                int currentPartitionIndex = networkPartitionContext.getCurrentPartitionIndex();
                if (partitions.get(currentPartitionIndex) instanceof Partition) {
                    Partition currentPartition = (Partition) partitions.get(currentPartitionIndex);
                    String currentPartitionId =  currentPartition.getId();

                    // point to next partition
                    int nextPartitionIndex = currentPartitionIndex  == noOfPartitions - 1 ? 0 : currentPartitionIndex+1;
                    networkPartitionContext.setCurrentPartitionIndex(nextPartitionIndex);
                    int nonTerminatedMemberCountOfPartition = networkPartitionContext.getNonTerminatedMemberCountOfPartition(currentPartitionId);
                    if(nonTerminatedMemberCountOfPartition < currentPartition.getPartitionMax()){
                        // current partition is free
                        if (log.isDebugEnabled())
                            log.debug(String.format("A free space found for scale up in partition %s [current] %s [max] %s",
                                    currentPartitionId, networkPartitionContext.getNonTerminatedMemberCountOfPartition(currentPartitionId),
                                                                    currentPartition.getPartitionMax()))  ;
                        return currentPartition;
                    }

                    if(log.isDebugEnabled())
                        log.debug("No free space for a new instance in partition " + currentPartition.getId());

                }
            }

            // none of the partitions were free.
View Full Code Here


                // Set next partition as current partition in Autoscaler Context
                networkPartitionContext.setCurrentPartitionIndex(currentPartitionIndex);

                if (partitions.get(currentPartitionIndex) instanceof Partition) {

                    Partition currentPartition = (Partition) partitions.get(currentPartitionIndex);
                    String currentPartitionId = currentPartition.getId();

                    // has more than minimum instances.
                    int currentlyActiveMemberCount = networkPartitionContext.getActiveMemberCount(currentPartitionId);
                    if (currentlyActiveMemberCount > currentPartition.getPartitionMin()) {
                        // current partition is free
                        if (log.isDebugEnabled())
                            log.debug(String.format("A free space found for scale down in partition %s [current] %s [min] %s",
                                    currentPartitionId, currentlyActiveMemberCount, currentPartition.getPartitionMin()))  ;
                        return currentPartition;
                    }else {

                        if (currentPartitionIndex == 0) {
                            if (log.isDebugEnabled())
                                log.debug(String.format("Partition %s reached with no space to scale down," +
                                        "[current] %s [min] %s", currentPartitionId, currentlyActiveMemberCount,
                                        currentPartition.getPartitionMin()));
                            return null;
                        }
                    }
                }
            }
View Full Code Here

                                                              PartitionManager.getInstance()
                                                                              .getNetworkPartitionLbHolder(partitionGroup.getId());
//                                                              PartitionManager.getInstance()
//                                                                              .getNetworkPartitionLbHolder(partitionGroup.getId());
            // FIXME pick a random partition
            Partition partition =
                                  partitionGroup.getPartitions()[new Random().nextInt(partitionGroup.getPartitions().length)];
            PartitionContext partitionContext = new PartitionContext(partition);
            partitionContext.setServiceName(cluster.getServiceName());
            partitionContext.setProperties(cluster.getProperties());
            partitionContext.setNetworkPartitionId(partitionGroup.getId());
View Full Code Here

  }

  public Partition getPartition(
      String partitionId) throws RemoteException {

    Partition partition;
    partition = stub.getPartition(partitionId);

    return partition;
  }
View Full Code Here

TOP

Related Classes of org.apache.stratos.cloud.controller.stub.deployment.partition.Partition

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.