Java 类com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest 实例源码

项目:photon-model    文件:AWSLoadBalancerService.java   
private DeferredResult<AWSLoadBalancerContext> configureHealthCheck(
        AWSLoadBalancerContext context) {

    ConfigureHealthCheckRequest request = buildHealthCheckRequest(context);

    if (request == null) {
        return DeferredResult.completed(context);
    }

    String message = "Configure a health check to AWS Load Balancer with name ["
            + context.loadBalancerStateExpanded.name + "].";
    AWSDeferredResultAsyncHandler<ConfigureHealthCheckRequest, ConfigureHealthCheckResult> handler =
            new AWSDeferredResultAsyncHandler<>(this, message);

    context.client.configureHealthCheckAsync(request, handler);

    return handler.toDeferredResult().thenApply(ignore -> context);
}
项目:photon-model    文件:AWSLoadBalancerService.java   
private ConfigureHealthCheckRequest buildHealthCheckRequest(AWSLoadBalancerContext context) {

        HealthCheckConfiguration healthCheckConfiguration = context.loadBalancerStateExpanded.routes
                .stream()
                .filter(config -> config != null && config.healthCheckConfiguration != null)
                .map(config -> config.healthCheckConfiguration).findFirst().orElse(null);

        if (healthCheckConfiguration == null) {
            return null;
        }

        // Construct the target HTTP:80/index.html
        String target = healthCheckConfiguration.protocol + ":" + healthCheckConfiguration.port
                + healthCheckConfiguration.urlPath;

        HealthCheck healthCheck = new HealthCheck()
                .withHealthyThreshold(healthCheckConfiguration.healthyThreshold)
                .withInterval(healthCheckConfiguration.intervalSeconds).withTarget(target)
                .withTimeout(healthCheckConfiguration.timeoutSeconds)
                .withUnhealthyThreshold(healthCheckConfiguration.unhealthyThreshold);

        return new ConfigureHealthCheckRequest()
                .withLoadBalancerName(context.loadBalancerStateExpanded.name)
                .withHealthCheck(healthCheck);
    }
项目:cmn-project    文件:CreateELBTask.java   
private void configureHealthCheck() {
    // optimize for high load the instances take longer to response, especially in Multi-AZ,
    // there are multiple ELB instances send health check requests same time
    HealthCheck healthCheck = new HealthCheck()
        .withHealthyThreshold(2)
        .withUnhealthyThreshold(5)
        .withInterval(20)
        .withTimeout(15)
        .withTarget("HTTP:80" + resource.healthCheckURL);
    AWS.elb.elb.configureHealthCheck(new ConfigureHealthCheckRequest(resource.name, healthCheck));
}
项目:primecloud-controller    文件:AwsLoadBalancerProcess.java   
public void configureHealthCheck(AwsProcessClient awsProcessClient, Long loadBalancerNo) {
    LoadBalancerHealthCheck healthCheck = loadBalancerHealthCheckDao.read(loadBalancerNo);

    // ヘルスチェック情報がない場合はスキップ
    if (healthCheck == null) {
        return;
    }

    AwsLoadBalancer awsLoadBalancer = awsLoadBalancerDao.read(loadBalancerNo);

    // ヘルスチェック設定を作成
    HealthCheck healthCheck2 = new HealthCheck();
    String target = healthCheck.getCheckProtocol() + ":" + healthCheck.getCheckPort();
    if (StringUtils.isNotEmpty(healthCheck.getCheckPath())) {
        if (healthCheck.getCheckPath().charAt(0) != '/') {
            target = target + "/";
        }
        target = target + healthCheck.getCheckPath();
    }
    healthCheck2.withTarget(target);
    healthCheck2.withTimeout(healthCheck.getCheckTimeout());
    healthCheck2.withInterval(healthCheck.getCheckInterval());
    healthCheck2.withHealthyThreshold(healthCheck.getHealthyThreshold());
    healthCheck2.withUnhealthyThreshold(healthCheck.getUnhealthyThreshold());

    // ヘルスチェック設定に変更がない場合はスキップ
    LoadBalancerDescription description = awsCommonProcess.describeLoadBalancer(awsProcessClient,
            awsLoadBalancer.getName());
    HealthCheck healthCheck3 = description.getHealthCheck();
    if (StringUtils.equals(healthCheck2.getTarget(), healthCheck3.getTarget())
            && ObjectUtils.equals(healthCheck2.getTimeout(), healthCheck3.getTimeout())
            && ObjectUtils.equals(healthCheck2.getInterval(), healthCheck3.getInterval())
            && ObjectUtils.equals(healthCheck2.getHealthyThreshold(), healthCheck3.getHealthyThreshold())
            && ObjectUtils.equals(healthCheck2.getUnhealthyThreshold(), healthCheck3.getUnhealthyThreshold())) {
        return;
    }

    // ヘルスチェック設定を変更
    ConfigureHealthCheckRequest request = new ConfigureHealthCheckRequest();
    request.withLoadBalancerName(awsLoadBalancer.getName());
    request.withHealthCheck(healthCheck2);
    awsProcessClient.getElbClient().configureHealthCheck(request);

    if (log.isInfoEnabled()) {
        log.info(MessageUtils.getMessage("IPROCESS-200131", awsLoadBalancer.getName()));
    }

    // イベントログ出力
    processLogger.debug(null, null, "AwsElbHealthCheckConfig", new Object[] {
            awsProcessClient.getPlatform().getPlatformName(), awsLoadBalancer.getName() });
}