This method is used to initialize the resource type to max CPU mapping
based upon the cpuToResourcePartitioning instance given
@param cpuToResourcePartitioning Mapping of cpus to resources to be used
977130
public void initResourceTypeToMaxCpuMap(Map<Integer, Map<ResourceType,
                                          Integer>> cpuToResourcePartitioning) {
    resourceTypeToMaxCpu =
      getResourceTypeToCountMap((int) clusterNodeInfo.total.numCpus,
        cpuToResourcePartitioning);
  }
1260211
public void preparePartitions(Map config, int totalTasks, int taskIndex, SpoutOutputCollector collector) throws Exception {
    this.collector = collector;
    if(stateStore == null) {
      String zkEndpointAddress = eventHubConfig.getZkConnectionString();
      if (zkEndpointAddress == null || zkEndpointAddress.length() == 0) {
        //use storm's zookeeper servers if not specified.
        @SuppressWarnings("unchecked")
        List<String> zkServers = (List<String>) config.get(Config.STORM_ZOOKEEPER_SERVERS);
        Integer zkPort = ((Number) config.get(Config.STORM_ZOOKEEPER_PORT)).intValue();
        StringBuilder sb = new StringBuilder();
        for (String zk : zkServers) {
          if (sb.length() > 0) {
            sb.append(',');
          }
          sb.append(zk+":"+zkPort);
        }
        zkEndpointAddress = sb.toString();
      }
      stateStore = new ZookeeperStateStore(zkEndpointAddress,
          (Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_TIMES),
          (Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL));
    }
    stateStore.open();

    partitionCoordinator = new StaticPartitionCoordinator(
        eventHubConfig, taskIndex, totalTasks, stateStore, pmFactory, recvFactory);

    for (IPartitionManager partitionManager : 
      partitionCoordinator.getMyPartitionManagers()) {
      partitionManager.open();
    }
  }
1041598
private static <L> void populateMetricTypesForResourceType(
            ResourceType.Builder<?, L> resourceTypeBuilder,
            TypeSets.Builder<L> typeSetsBuilder) {

        Map<Name, TypeSet<MetricType<L>>> metricTypeSets = typeSetsBuilder.getMetricTypeSets();
        List<Name> metricSetNames = resourceTypeBuilder.getMetricSetNames();
        for (Name metricSetName : metricSetNames) {
            TypeSet<MetricType<L>> metricSet = metricTypeSets.get(metricSetName);
            if (metricSet != null && metricSet.isEnabled()) {
                resourceTypeBuilder.metricTypes(metricSet.getTypeMap().values());
            }
        }

    }
514892
private void commitSource() {
        int partitionId = getPartitionId();
        InternalPartitionServiceImpl partitionService = getService();
        PartitionReplicaManager replicaManager = partitionService.getReplicaManager();

        ILogger logger = getLogger();

        int sourceNewReplicaIndex = migrationInfo.getSourceNewReplicaIndex();
        if (sourceNewReplicaIndex < 0) {
            clearPartitionReplicaVersions(partitionId);
            if (logger.isFinestEnabled()) {
                logger.finest("Replica versions are cleared in source after migration. partitionId=" + partitionId);
            }
        } else if (migrationInfo.getSourceCurrentReplicaIndex() != sourceNewReplicaIndex && sourceNewReplicaIndex > 1) {
            for (ServiceNamespace namespace : replicaManager.getNamespaces(partitionId)) {
                long[] versions = updatePartitionReplicaVersions(replicaManager, partitionId,
                                                                 namespace, sourceNewReplicaIndex - 1);
                if (logger.isFinestEnabled()) {
                    logger.finest("Replica versions are set after SHIFT DOWN migration. partitionId="
                            + partitionId + " namespace: " + namespace + " replica versions=" + Arrays.toString(versions));
                }
            }
        }
    }
780842
public void setResources(java.util.Collection<HandshakeResource> resources) {
        if (resources == null) {
            this.resources = null;
            return;
        }

        this.resources = new java.util.ArrayList<HandshakeResource>(resources);
    }
722851
public void setResourceTagMappingList(java.util.Collection<ResourceTagMapping> resourceTagMappingList) {
        if (resourceTagMappingList == null) {
            this.resourceTagMappingList = null;
            return;
        }

        this.resourceTagMappingList = new java.util.ArrayList<ResourceTagMapping>(resourceTagMappingList);
    }
1339447
private void addDataSources(Table table, int hostId,
            List<Pair<Integer, Integer>> localPartitionsToSites,
            Set<Integer> partitionsInUse,
            final ExportDataProcessor processor,
            final long genId,
            boolean isCatalogUpdate)
    {
        for (Pair<Integer, Integer> partitionAndSiteId : localPartitionsToSites) {

            /*
             * IOException can occur if there is a problem
             * with the persistent aspects of the datasource storage
             */
            int partition = partitionAndSiteId.getFirst();
            int siteId = partitionAndSiteId.getSecond();
            synchronized(m_dataSourcesByPartition) {
                try {
                    Map<String, ExportDataSource> dataSourcesForPartition = m_dataSourcesByPartition.get(partition);
                    if (dataSourcesForPartition == null) {
                        dataSourcesForPartition = new HashMap<String, ExportDataSource>();
                        m_dataSourcesByPartition.put(partition, dataSourcesForPartition);
                    }
                    final String key = table.getTypeName();
                    if (!dataSourcesForPartition.containsKey(key)) {
                        ExportDataSource exportDataSource = new ExportDataSource(this,
                                processor,
                                "database",
                                key,
                                partition,
                                siteId,
                                genId,
                                table.getColumns(),
                                table.getPartitioncolumn(),
                                m_directory.getPath());
                        int migrateBatchSize = CatalogUtil.getPersistentMigrateBatchSize(key);
                        exportDataSource.setupMigrateRowsDeleter(migrateBatchSize);
                        if (exportLog.isDebugEnabled()) {
                            exportLog.debug("Creating ExportDataSource for table in catalog " + key
                                    + " partition " + partition + " site " + siteId);
                        }
                        dataSourcesForPartition.put(key, exportDataSource);
                        if (isCatalogUpdate) {
                            exportDataSource.updateCatalog(table, genId);
                        }
                    } else {
                        // Associate any existing EDS to the export client in the new processor
                        ExportDataSource eds = dataSourcesForPartition.get(key);

                        ExportClientBase client = processor.getExportClient(key);
                        if (client != null) {
                            // Associate to an existing export client
                            eds.setClient(client);
                            eds.setRunEveryWhere(client.isRunEverywhere());
                        } else {
                            // Reset to no export client
                            eds.setClient(null);
                            eds.setRunEveryWhere(false);
                        }

                        // Mark in catalog only if partition is in use
                        eds.markInCatalog(partitionsInUse.contains(partition));
                        if (isCatalogUpdate) {
                            eds.updateCatalog(table, genId);
                        }
                    }
                } catch (IOException e) {
                    VoltDB.crashLocalVoltDB(
                            "Error creating datasources for table " +
                            table.getTypeName() + " host id " + hostId, true, e);
                }
            }
        }
    }
875149
public void setCores(java.util.Collection<Core> cores) {
        if (cores == null) {
            this.cores = null;
            return;
        }

        this.cores = new java.util.ArrayList<Core>(cores);
    }
351698
private void initBuildScoreChildrenSettings(BuildScoreSettings buildScoreSettings) {
    ScoreComponentSettings buildStatusSettings = Utils.getInstanceIfNull(
      buildScoreSettings.getStatus(),
      ScoreComponentSettings.class
    );
    buildStatusSettings.setCriteria(
      Utils.mergeCriteria(buildScoreSettings.getCriteria(), buildStatusSettings.getCriteria())
    );
    buildScoreSettings.setStatus(buildStatusSettings);

    BuildScoreSettings.BuildDurationScoreSettings buildDurationSettings = Utils.getInstanceIfNull(
      buildScoreSettings.getDuration(),
      BuildScoreSettings.BuildDurationScoreSettings.class
    );

    buildDurationSettings.setCriteria(
      Utils.mergeCriteria(buildScoreSettings.getCriteria(), buildDurationSettings.getCriteria())
    );
    buildScoreSettings.setDuration(buildDurationSettings);
  }
545283
@Override
    public void init(CollectorManager collectorManager) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Subscribing to sources " + this, taskMap.keySet());
        }
        try {
            this.collectorMgr = collectorManager;
            //Get the source Ids from the task map and subscribe to relevant sources
            collectorMgr.subscribe(this, new ArrayList<String>(taskMap.keySet()));
        } catch (Exception e) {

        } finally {
            latch.countDown();
        }
    }
980658
public void setAccountAggregationSources(java.util.Collection<AccountAggregationSource> accountAggregationSources) {
        if (accountAggregationSources == null) {
            this.accountAggregationSources = null;
            return;
        }

        this.accountAggregationSources = new com.amazonaws.internal.SdkInternalList<AccountAggregationSource>(accountAggregationSources);
    }
950390
public void setResourceTypeList(java.util.Collection<String> resourceTypeList) {
        if (resourceTypeList == null) {
            this.resourceTypeList = null;
            return;
        }

        this.resourceTypeList = new java.util.ArrayList<String>(resourceTypeList);
    }
517434
public void setResourceUris(java.util.Collection<ResourceUri> resourceUris) {
        if (resourceUris == null) {
            this.resourceUris = null;
            return;
        }

        this.resourceUris = new java.util.ArrayList<ResourceUri>(resourceUris);
    }
148789
public static Map<ResourceType, Integer> getResourceTypeToCountMap(
      int numCpus,
      Map<Integer, Map<ResourceType, Integer>> cpuToResourcePartitioning) {
    Map<ResourceType, Integer> ret =
        cpuToResourcePartitioning.get(numCpus);
    if (ret == null) {
      Map<ResourceType, Integer> oneCpuMap = cpuToResourcePartitioning.get(1);
      if (oneCpuMap == null) {
        throw new RuntimeException(
          "No matching entry for cpu count: " + numCpus +
          " in node and no 1 cpu map");
      }

      ret = new EnumMap<ResourceType, Integer>(ResourceType.class);
      for (ResourceType key: oneCpuMap.keySet()) {
        ret.put(key, oneCpuMap.get(key).intValue() * numCpus);
      }
    }
    return ret;
  }
461983
public static host_cpu_core[] get(nitro_service client) throws Exception
	{
		host_cpu_core resource = new host_cpu_core();
		resource.validate("get");
		return (host_cpu_core[]) resource.get_resources(client);
	}
293038
public void setAllocatedResource(final AllocatedResource resource) {

		final Iterator<ExecutionVertex> it = this.vertices.iterator();
		while (it.hasNext()) {
			final ExecutionVertex vertex = it.next();
			vertex.setAllocatedResource(resource);
		}
	}
218049
public void setProcessors(java.util.Collection<Processor> processors) {
        if (processors == null) {
            this.processors = null;
            return;
        }

        this.processors = new java.util.ArrayList<Processor>(processors);
    }