/* (non-Javadoc)
@see com.impetus.kundera.loader.GenericClientFactory#initializeLoadBalancer(java.lang.String)
324808
@Override
    protected void initializeLoadBalancer(String loadBalancingPolicyName)
    {
        if (loadBalancingPolicyName != null)
        {
            switch (LoadBalancer.getValue(loadBalancingPolicyName))
            {
            case ROUNDROBIN:
                loadBalancingPolicy = new RoundRobinBalancingPolicy();
                break;
            case LEASTACTIVE:
                loadBalancingPolicy = new ThriftLeastActiveBalancingPolcy();
                break;
            default:
                loadBalancingPolicy = new RoundRobinBalancingPolicy();
                break;
            }
        }
        loadBalancingPolicy = new RoundRobinBalancingPolicy();
    }
895310
protected void initBinder(final HttpServletRequest request, final ServletRequestDataBinder binder) {
        if (serviceValidateConfigurationContext.isRenewEnabled()) {
            binder.setRequiredFields(CasProtocolConstants.PARAMETER_RENEW);
        }
    }
86772
public OperationFuture<List<LoadBalancer>> delete(LoadBalancer... loadBalancer) {
        return delete(Arrays.asList(loadBalancer));
    }
421117
@Override
  public void init(FilterConfig config)
      throws ServletException {
    if(config.getInitParameter("ignorePrefix") != null) {
      ignorePath = config.getInitParameter("ignorePrefix");
    }
  }
65762
public void setLoadBalancerNames(java.util.Collection<String> loadBalancerNames) {
        if (loadBalancerNames == null) {
            this.loadBalancerNames = null;
            return;
        }

        this.loadBalancerNames = new com.amazonaws.internal.SdkInternalList<String>(loadBalancerNames);
    }
1086783
public void init(final FilterConfig filterConfig) {

        final String denyParam = filterConfig.getInitParameter("denyUrls");
        if (StringUtils.isNotBlank(denyParam)) {
            this.denyUrls = denyParam.split(",");
        }

        final String ignoreParam = filterConfig.getInitParameter("ignoreUrls");
        if (StringUtils.isNotBlank(ignoreParam)) {
            this.ignoreUrls = ignoreParam.split(",");
        }

    }
372706
public static LoadBalancer getLoadBalancer(ConsumerBootstrap consumerBootstrap) {
        try {
            String loadBalancer = consumerBootstrap.getConsumerConfig().getLoadBalancer();
            ExtensionClass<LoadBalancer> ext = ExtensionLoaderFactory
                .getExtensionLoader(LoadBalancer.class).getExtensionClass(loadBalancer);
            if (ext == null) {
                throw ExceptionUtils.buildRuntime("consumer.loadBalancer",
                    loadBalancer, "Unsupported loadBalancer of client!");
            }
            return ext.getExtInstance(new Class[] { ConsumerBootstrap.class }, new Object[] { consumerBootstrap });
        } catch (SofaRpcRuntimeException e) {
            throw e;
        } catch (Throwable e) {
            throw new SofaRpcRuntimeException(e.getMessage(), e);
        }
    }
1349558
void initialize() {
        // Cancel any running tasks
        Timer oldTimer = timer;
        timer = new Timer(true);
        if (Objects.nonNull(oldTimer)) {
            oldTimer.cancel();
        }
        // (re)initialize
        LoaderConfigurator configurator = new LoaderConfigurator(this);
        defaultLoaderServiceFacade = new DefaultLoaderServiceFacade(timer, listener, resources);
        configurator.load();
    }
479040
public void setClassLoader(ClassLoader loader) {
    this.classLoader = loader;
    // Note that this class is immutable after construction, except for the class loader
    // Thus we can pass down the loader to the owner and parameter types once now, no need to pass it down in toType()
    if (this.enclosingType != null) {
      this.enclosingType.setClassLoader(loader);
    }
    if (this.parameters != null) {
      for (TypeRepresentation param: this.parameters) {
        param.setClassLoader(loader);
      }
    }
  }
805317
@Override
	public void initialize(IAggregator aggregator, IAggregatorExtension extension, IExtensionRegistrar reg) {
		this.aggregator = aggregator;

		resourcePathId = extension.getAttribute(IHttpTransportExtensionPoint.PATH_ATTRIBUTE);
		if (resourcePathId == null) {
			throw new IllegalArgumentException(
				IHttpTransportExtensionPoint.PATH_ATTRIBUTE  +
				" attribute not specified for extension " + //$NON-NLS-1$
				extension.getUniqueId()
			);
		}

		String comboUriStr = extension.getAttribute(IHttpTransportExtensionPoint.RESOURCESURI_ATTRIBUTE);
		if (comboUriStr == null) {
			throw new IllegalArgumentException(
				IHttpTransportExtensionPoint.RESOURCESURI_ATTRIBUTE  +
				" attribute not specified for extension " + //$NON-NLS-1$
				extension.getUniqueId()
			);
		} else {
			comboUri = URI.create(comboUriStr);
		}

		transportId = extension.getUniqueId();

		URI featureListResourceUri = getFeatureListResourceUri();
		// register a config listener so that we get notified of changes to
		// the server-side AMD config file.
		String name = aggregator.getName();
		Dictionary<String, String> dict = new Hashtable<String, String>();
		dict.put("name", name); //$NON-NLS-1$
		serviceRegistrations.add(aggregator.getPlatformServices().registerService(
				IConfigModifier.class.getName(), this, dict
				));
		dict = new Hashtable<String, String>();
		dict.put("name", name); //$NON-NLS-1$
		serviceRegistrations.add(aggregator.getPlatformServices().registerService(
				IShutdownListener.class.getName(), this, dict
				));
		dict = new Hashtable<String, String>();
		dict.put("name", aggregator.getName()); //$NON-NLS-1$
		serviceRegistrations.add(aggregator.getPlatformServices().registerService(
				IDependenciesListener.class.getName(), this, dict));

		if (featureListResourceUri != null) {
			depsInitialized = new CountDownLatch(1);

			// Get first resource factory extension so we can add to beginning of list
			Iterable<IAggregatorExtension> resourceFactoryExtensions = aggregator.getExtensions(IResourceFactoryExtensionPoint.ID);
			IAggregatorExtension first = resourceFactoryExtensions.iterator().next();

			// Register the featureMap resource factory
			Properties props = new Properties();
			props.put("scheme", getComboUri().getScheme()); //$NON-NLS-1$
			reg.registerExtension(
					newFeatureListResourceFactory(featureListResourceUri),
					props,
					new InitParams(Collections.<InitParam>emptyList()),
					IResourceFactoryExtensionPoint.ID,
					getTransportId(),
					first);

		}
	}
495305
@Override
    public void init(FilterConfig filterConfig) throws ServletException {
        super.init(filterConfig);

        int compressionMinSize = readInt(filterConfig.getInitParameter(INIT_PARAM_COMPRESSION_THRESHOLD), this.compressionThreshold);
        long decompressMaxBytesPerSecond = readLong(filterConfig.getInitParameter(INIT_PARAM_DECOMPRESS_MAX_BYTES_PER_SECOND),
                this.decompressionRate);

        long maxDecompressedRequestSize = readLong(filterConfig.getInitParameter(INIT_PARAM_MAX_DECOMPRESSED_REQUEST_SIZE_IN_BYTES),
                this.maxDecompressedRequestSizeInBytes);

        if (compressionMinSize > 0) { // priority given to configured value
            this.compressionThreshold = compressionMinSize;
        }
        if (decompressMaxBytesPerSecond > 0) { // priority given to configured value
            this.decompressionRate = decompressMaxBytesPerSecond;
        }
        if (maxDecompressedRequestSize > 0) { // priority given to configured value
            this.maxDecompressedRequestSizeInBytes = maxDecompressedRequestSize;
        }
        LOGGER.trace("Filter initialized with: {}:{},\n{}:{}\n{}:{}", INIT_PARAM_COMPRESSION_THRESHOLD, String.valueOf(this.compressionThreshold),
                INIT_PARAM_DECOMPRESS_MAX_BYTES_PER_SECOND, String.valueOf(this.decompressionRate),
                INIT_PARAM_MAX_DECOMPRESSED_REQUEST_SIZE_IN_BYTES, String.valueOf(this.maxDecompressedRequestSizeInBytes));
    }
9486
@Nullable
  ConfigOrError selectLoadBalancerPolicy(Map<String, ?> serviceConfig) {
    try {
      List<LbConfig> loadBalancerConfigs = null;
      if (serviceConfig != null) {
        List<Map<String, ?>> rawLbConfigs =
            ServiceConfigUtil.getLoadBalancingConfigsFromServiceConfig(serviceConfig);
        loadBalancerConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(rawLbConfigs);
      }
      if (loadBalancerConfigs != null && !loadBalancerConfigs.isEmpty()) {
        List<String> policiesTried = new ArrayList<>();
        for (LbConfig lbConfig : loadBalancerConfigs) {
          String policy = lbConfig.getPolicyName();
          LoadBalancerProvider provider = registry.getProvider(policy);
          if (provider == null) {
            policiesTried.add(policy);
          } else {
            return ConfigOrError.fromConfig(new PolicySelection(
                provider,
                /* serverList= */ null,
                lbConfig.getRawConfigValue()));
          }
        }
        return ConfigOrError.fromError(
            Status.UNKNOWN.withDescription(
                "None of " + policiesTried + " specified by Service Config are available."));
      }
      return null;
    } catch (RuntimeException e) {
      return ConfigOrError.fromError(
          Status.UNKNOWN.withDescription("can't parse load balancer configuration").withCause(e));
    }
  }
470892
public void initLoad(Class<? extends AbstractZealotConfig> clazz, String xmlLocations,
            String handlerLocations) {
        this.initLoad(clazz.getName(), xmlLocations, handlerLocations);
    }
283754
@Override
    public void init(final FilterConfig filterConfig) throws ServletException {

        // verify there are no init parameters configured that are not recognized
        // since an unrecognized init param might be the adopter trying to configure this filter in
        // an important way
        // and accidentally ignoring that intent might have security implications.
        final Enumeration initParamNames = filterConfig.getInitParameterNames();
        throwIfUnrecognizedParamName(initParamNames);

        final String initParamAllowMultiValuedParameters =
                filterConfig.getInitParameter(ALLOW_MULTI_VALUED_PARAMETERS);
        final String initParamParametersToCheck =
                filterConfig.getInitParameter(PARAMETERS_TO_CHECK);
        final String initParamCharactersToForbid =
                filterConfig.getInitParameter(CHARACTERS_TO_FORBID);

        try {
            this.allowMultiValueParameters =
                    parseStringToBooleanDefaultingToFalse(initParamAllowMultiValuedParameters);
        } catch (final Exception e) {
            throw new ServletException(
                    "Error parsing request parameter ["
                            + ALLOW_MULTI_VALUED_PARAMETERS
                            + "] with value ["
                            + initParamAllowMultiValuedParameters
                            + "]",
                    e);
        }

        try {
            this.parametersToCheck = parseParametersToCheck(initParamParametersToCheck);
        } catch (final Exception e) {
            throw new ServletException(
                    "Error parsing request parameter "
                            + PARAMETERS_TO_CHECK
                            + " with value ["
                            + initParamParametersToCheck
                            + "]",
                    e);
        }

        try {
            this.charactersToForbid = parseCharactersToForbid(initParamCharactersToForbid);
        } catch (final Exception e) {
            throw new ServletException(
                    "Error parsing request parameter "
                            + CHARACTERS_TO_FORBID
                            + " with value ["
                            + initParamCharactersToForbid
                            + "]",
                    e);
        }

        if (this.allowMultiValueParameters && this.charactersToForbid.isEmpty()) {
            throw new ServletException(
                    "Configuration to allow multi-value parameters and forbid no characters makes "
                            + getClass().getSimpleName()
                            + " a no-op, which is probably not what you want, "
                            + "so failing Filter init.");
        }
    }
767995
public void setLoadBalancers(java.util.Collection<LoadBalancerState> loadBalancers) {
        if (loadBalancers == null) {
            this.loadBalancers = null;
            return;
        }

        this.loadBalancers = new com.amazonaws.internal.SdkInternalList<LoadBalancerState>(loadBalancers);
    }
1134483
public static synchronized void initializeEnvironment()
  {
    if (_isStaticInit)
      return;

    _isStaticInit = true;

    ClassLoader systemLoader = ClassLoader.getSystemClassLoader();

    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();
    try {
      thread.setContextClassLoader(systemLoader);
      
      if ("1.8.".compareTo(System.getProperty("java.runtime.version")) > 0)
        throw new ConfigException("Baratine requires JDK 1.8 or later");

      // #2281
      // PolicyImpl.init();

      //EnvironmentStream.setStdout(System.out);
      //EnvironmentStream.setStderr(System.err);

      /*
      try {
        Vfs.initJNI();
      } catch (Throwable e) {
      }
      */
      
      Properties props = System.getProperties();

      ClassLoader envClassLoader
        = EnvironmentClassLoader.class.getClassLoader();

      /*
      boolean isGlobalLoadableJndi = false;
      try {
        Class<?> cl = Class.forName("com.caucho.v5.naming.InitialContextFactoryImpl",
                                    false,
                                    systemLoader);

        isGlobalLoadableJndi = (cl != null);
      } catch (Exception e) {
        log().log(Level.FINER, e.toString(), e);
      }
      
      // #3486
      String namingPkgs = (String) props.get("java.naming.factory.url.pkgs");
      if (namingPkgs == null)
        namingPkgs = "com.caucho.v5.naming";
      else
        namingPkgs = namingPkgs + ":" + "com.caucho.v5.naming";
      props.put("java.naming.factory.url.pkgs", namingPkgs);

      if (isGlobalLoadableJndi) {
        // These properties require the server to be at the system loader

        if (props.get("java.naming.factory.initial") == null) {
          props.put("java.naming.factory.initial",
                    "com.caucho.v5.naming.InitialContextFactoryImpl");
        }
      }
      */

      /*
      boolean isGlobalLoadableJmx = false;
      try {
        Class<?> cl = Class.forName("com.caucho.v5.jmx.MBeanServerBuilderImpl",
                                    false,
                                    systemLoader);

        isGlobalLoadableJmx = (cl != null);
      } catch (Exception e) {
        log().log(Level.FINER, e.toString(), e);
      }
      
      if (isGlobalLoadableJmx) {
        // props.put("java.naming.factory.url.pkgs", "com.caucho.naming");

        EnvironmentProperties.enableEnvironmentSystemProperties(true);

        String oldBuilder = props.getProperty("javax.management.builder.initial");
        if (oldBuilder == null) {
          oldBuilder = "com.caucho.v5.jmx.MBeanServerBuilderImpl";
          props.put("javax.management.builder.initial", oldBuilder);
        }

        Object value = ManagementFactory.getPlatformMBeanServer();
      }
      */
    } catch (Throwable e) {
      log().log(Level.FINE, e.toString(), e);
    } finally {
      thread.setContextClassLoader(oldLoader);
      
      _isInitComplete = true;
    }
  }
310038
public void init(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry,
                     UploadManager uploadManager, MessageReader messageReader,
                     ZookeeperConnector zookeeperConnector, MetricCollector metricCollector,
                     DeterministicUploadPolicyTracker deterministicUploadPolicyTracker) {
        mConfig = config;
        mOffsetTracker = offsetTracker;
        mFileRegistry = fileRegistry;
        mUploadManager = uploadManager;
        mMessageReader = messageReader;
        mZookeeperConnector = zookeeperConnector;
        mTopicFilter = mConfig.getKafkaTopicUploadAtMinuteMarkFilter();
        mMetricCollector = metricCollector;
        mDeterministicUploadPolicyTracker = deterministicUploadPolicyTracker;
        if (mConfig.getOffsetsStorage().equals(SecorConstants.KAFKA_OFFSETS_STORAGE_KAFKA)) {
            isOffsetsStorageKafka = true;
        }
    }