Create a RPC service for the task manager.

@param configuration The configuration for the TaskManager.
@param haServices to use for the task manager hostname retrieval
500038
public static RpcService createRpcService(
			final Configuration configuration,
			final HighAvailabilityServices haServices) throws Exception {

		checkNotNull(configuration);
		checkNotNull(haServices);

		final String taskManagerAddress = determineTaskManagerBindAddress(configuration, haServices);
		final String portRangeDefinition = configuration.getString(TaskManagerOptions.RPC_PORT);

		return AkkaRpcServiceUtils.createRpcService(taskManagerAddress, portRangeDefinition, configuration);
	}
488977
private void loadKiteConf(Services services) throws IOException {
    String[] paths = services.getConf().getStrings(KITE_CONFIGURATION);
    if (paths != null && paths.length != 0) {
      kiteConf = new Configuration(false);
      for(String path : paths) {
        if (path.startsWith("hdfs")) {
            Path p = new Path(path);
            HadoopAccessorService has = services.get(HadoopAccessorService.class);
            
            try {
                FileSystem fs = has.createFileSystem(
                        System.getProperty("user.name"), p.toUri(), has.createJobConf(p.toUri().getAuthority()));
                if (fs.exists(p)) {
                    FSDataInputStream is = null;
                    try {
                        is = fs.open(p);
                        Configuration partialConf = new XConfiguration(is);
                        kiteConf = merge(kiteConf, partialConf);
                    } finally {
                        if (is != null) {
                            is.close();
                        }
                    }
                    LOG.info("Loaded Kite Configuration: " + path);
                } else {
                    LOG.warn("Kite Configuration could not be found at [" + path + "]");
                }
            } catch (HadoopAccessorException hae) {
                throw new IOException(hae);
            }
        } else {
            File f = new File(path);
            if (f.exists()) {
                InputStream is = null;
                try {
                    is = new FileInputStream(f);
                    Configuration partialConf = new XConfiguration(is);
                    kiteConf = merge(kiteConf, partialConf);
                } finally {
                    if (is != null) {
                        is.close();
                    }
                }
                LOG.info("Loaded Kite Configuration: " + path);
            } else {
                LOG.warn("Kite Configuration could not be found at [" + path + "]");
            }
        }
      }
    } else {
      LOG.info("Kite Configuration not specified");
    }
  }
337468
@Override
  public Element unparseServiceCreationConfiguration(final ServiceCreationConfiguration<ClusteringService> serviceCreationConfiguration) {
    Element rootElement = unparseConfig(serviceCreationConfiguration);
    return rootElement;
  }
1367859
public static void createAndRegister(OcAgentMetricsExporterConfiguration configuration) {
    checkNotNull(configuration, "configuration");
    createInternal(
        configuration.getEndPoint(),
        configuration.getUseInsecure(),
        configuration.getSslContext(),
        configuration.getServiceName(),
        configuration.getExportInterval(),
        configuration.getRetryInterval());
  }
509566
public static ResourceManagerRuntimeServicesConfiguration fromConfiguration(Configuration configuration) throws ConfigurationException {

		final String strJobTimeout = configuration.getString(ResourceManagerOptions.JOB_TIMEOUT);
		final Time jobTimeout;

		try {
			jobTimeout = Time.milliseconds(Duration.apply(strJobTimeout).toMillis());
		} catch (NumberFormatException e) {
			throw new ConfigurationException("Could not parse the resource manager's job timeout " +
				"value " + ResourceManagerOptions.JOB_TIMEOUT + '.', e);
		}

		final SlotManagerConfiguration slotManagerConfiguration = SlotManagerConfiguration.fromConfiguration(configuration);

		return new ResourceManagerRuntimeServicesConfiguration(jobTimeout, slotManagerConfiguration);
	}
1329594
private void init(ExecutorService executorService, Configuration configuration) {
        cfg.getRequestContext().put(EXECUTOR_SERVICE_PROPERTY, executorService);
        cfg.getRequestContext().putAll(configuration.getProperties());

        List<Interceptor<? extends Message>>inboundChain = cfg.getInInterceptors();
        inboundChain.add(new MPAsyncInvocationInterceptorPostAsyncImpl());
        inboundChain.add(new MPAsyncInvocationInterceptorRemoveContextImpl());
    }
832921
public static ResourceManagerRuntimeServices fromConfiguration(
			ResourceManagerRuntimeServicesConfiguration configuration,
			HighAvailabilityServices highAvailabilityServices,
			ScheduledExecutor scheduledExecutor) throws Exception {

		final SlotManagerConfiguration slotManagerConfiguration = configuration.getSlotManagerConfiguration();

		final SlotManager slotManager = new SlotManager(
			scheduledExecutor,
			slotManagerConfiguration.getTaskManagerRequestTimeout(),
			slotManagerConfiguration.getSlotRequestTimeout(),
			slotManagerConfiguration.getTaskManagerTimeout(),
			slotManagerConfiguration.isWaitResultConsumedBeforeRelease());

		final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService(
			highAvailabilityServices,
			scheduledExecutor,
			configuration.getJobTimeout());

		return new ResourceManagerRuntimeServices(slotManager, jobLeaderIdService);
	}
410446
private Optional<Configuration> makeRootServiceConfiguration(final Optional<Configuration> serviceConfiguration) {
    final EvaluatorType evaluatorType = this.evaluatorManager.getEvaluatorDescriptor().getProcess().getType();
    if (EvaluatorType.CLR == evaluatorType) {
      LOG.log(Level.FINE, "Not using the ConfigurationProviders as we are configuring a {0} Evaluator.", evaluatorType);
      return serviceConfiguration;
    }

    if (!serviceConfiguration.isPresent() && this.evaluatorConfigurationProviders.isEmpty()) {
      // No configurations to merge.
      LOG.info("No service configuration given and no ConfigurationProviders set.");
      return Optional.empty();
    } else {
      final ConfigurationBuilder configurationBuilder = getConfigurationBuilder(serviceConfiguration);
      for (final ConfigurationProvider configurationProvider : this.evaluatorConfigurationProviders) {
        configurationBuilder.addConfiguration(configurationProvider.getConfiguration());
      }
      return Optional.of(configurationBuilder.build());
    }
  }
1114824
public final synchronized void initialize(Map<String,String> configuration)
    {
        if(this.initialized)
        {
            throw new FaxException("Service already initialized.");
        }
        
        //set flag
        this.initialized=true;

        //get configuration
        this.serviceConfiguration=new ConfigurationHolderImpl(configuration,this.propertyPart);

        //get logger
        LoggerManager loggerManager=LoggerManager.getInstance();
        this.serviceLogger=loggerManager.getLogger();
        
        //initialize
        this.initializeImpl();
    }
797720
def _update_container_host_config(self, service):
        
        if not isinstance(service, Service):
            raise TypeError("service must be an instance of Service")

        if service.dependencies:

            self._load_dependency_containers(service)

            if service.host_config.links:
                self._update_links(service)

            if service.host_config.volumes_from:
                self._update_volumes_from(service)
376417
public OperationFuture<ServerMetadata> create(CreateServerConfig config) {
        BaseServerResponse response = client.create(
            serverConverter.buildCreateServerRequest(
                config,
                config.getCustomFields().isEmpty() ?
                    null :
                    client.getCustomFields())
        );

        return postProcessBuildServerResponse(response, config);
    }
358572
@Override
  public Mono<ServiceDiscovery> start() {
    return Mono.defer(
        () -> {
          Map<String, String> metadata =
              endpoint != null
                  ? Collections.singletonMap(
                      endpoint.id(), ClusterMetadataCodec.encodeMetadata(endpoint))
                  : Collections.emptyMap();

          ClusterConfig clusterConfig = copyFrom(this.clusterConfig).addMetadata(metadata).build();
          ScalecubeServiceDiscovery serviceDiscovery =
              new ScalecubeServiceDiscovery(this, clusterConfig);

          return Cluster.join(clusterConfig)
              .doOnSuccess(cluster -> serviceDiscovery.cluster = cluster)
              .thenReturn(serviceDiscovery);
        });
  }
945850
public static void createDirectoriesOnWorker(SubProcessConfiguration configuration)
      throws IOException {

    try {

      Path path = Paths.get(configuration.getWorkerPath());

      if (!path.toFile().exists()) {
        Files.createDirectories(path);
        LOG.info(String.format("Created Folder %s ", path.toFile()));
      }
    } catch (FileAlreadyExistsException ex) {
      LOG.warn(String.format(
          " Tried to create folder %s which already existsed, this should not happen!",
          configuration.getWorkerPath()), ex);
    }
  }
587365
public void processConfiguration(Configuration configuration, Class<?> mapperInterface) {
        String prefix;
        if (mapperInterface != null) {
            prefix = mapperInterface.getCanonicalName();
        } else {
            prefix = "";
        }
        for (Object object : new ArrayList<Object>(configuration.getMappedStatements())) {
            if (object instanceof MappedStatement) {
                MappedStatement ms = (MappedStatement) object;
                if (ms.getId().startsWith(prefix)) {
                    processMappedStatement(ms);
                }
            }
        }
    }
39501
private void configure(Map<String, Object> configuration) throws IOException {
        List<TaskConfig> configList = new ArrayList<TaskConfig>();
        configList.addAll(parseConfig(configuration));
        for (TaskConfig taskConfig : configList) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Task config " + this, taskConfig);
            }
            if (taskConfig.getEnabled()) {
                //Create the task, set the configuration and add it to the map if it's not already present.
                Task task = new TaskImpl();
                if (task != null) {
                    //Check if task already exist (by check if the source id is already in the taskMap)
                    //if not, we set the task with the new config and get appropriate handler based on the type of source
                    //else, we simply replace the config in the original task with the modified config
                    if (!taskMap.containsKey(taskConfig.sourceId())) {
                        task.setHandlerName(getHandlerName());
                        task.setConfig(taskConfig);
                        taskMap.putIfAbsent(taskConfig.sourceId(), task);
                    } else {
                        taskMap.get(taskConfig.sourceId()).setConfig(taskConfig);
                    }
                }
            }
        }
    }
1037326
public Task applyHostConfig_Task(HostSystem host, HostConfigSpec configSpec, ProfileDeferredPolicyOptionParameter[] userInputs) throws HostConfigFailed, InvalidState, RuntimeFault, RemoteException {
        ManagedObjectReference taskMor = getVimService().applyHostConfig_Task(getMOR(), host.getMOR(), configSpec, userInputs);
        return new Task(getServerConnection(), taskMor);
    }
699789
public void submitTask(final String evaluatorConfiguration, final String taskConfiguration) {
    final Configuration contextConfiguration = ContextConfiguration.CONF
        .set(ContextConfiguration.IDENTIFIER, "RootContext_" + this.getId())
        .build();
    final String contextConfigurationString = this.configurationSerializer.toString(contextConfiguration);
    this.launchWithConfigurationString(
        evaluatorConfiguration, contextConfigurationString,  Optional.<String>empty(), Optional.of(taskConfiguration));
  }