Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License").
   * You may not use this file except in compliance with the License.
   * A copy of the License is located at
   * 
   *  http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed
  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.elasticloadbalancing.model;
 

Information about a health check.

 
 public class HealthCheck implements SerializableCloneable {

    
The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

 
     private String target;

    
The approximate interval, in seconds, between health checks of an individual instance.

Constraints:
Range: 1 - 300

 
     private Integer interval;

    
The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

Constraints:
Range: 1 - 300

 
     private Integer timeout;

    
The number of consecutive health check failures required before moving the instance to the Unhealthy state.

Constraints:
Range: 2 - 10

 
     private Integer unhealthyThreshold;

    
The number of consecutive health checks successes required before moving the instance to the Healthy state.

Constraints:
Range: 2 - 10

 
     private Integer healthyThreshold;

    
Default constructor for a new HealthCheck object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.
 
     public HealthCheck() {}
    
    
Constructs a new HealthCheck object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
target The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

interval The approximate interval, in seconds, between health checks of an individual instance.
timeout The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

unhealthyThreshold The number of consecutive health check failures required before moving the instance to the Unhealthy state.
healthyThreshold The number of consecutive health checks successes required before moving the instance to the Healthy state.
    public HealthCheck(String targetInteger intervalInteger timeoutInteger unhealthyThresholdInteger healthyThreshold) {
        setTarget(target);
        setInterval(interval);
        setTimeout(timeout);
        setUnhealthyThreshold(unhealthyThreshold);
        setHealthyThreshold(healthyThreshold);
    }

    
The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

Returns:
The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

    public String getTarget() {
        return ;
    }
    
    
The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

Parameters:
target The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

    public void setTarget(String target) {
        this. = target;
    }
    
    
The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

Returns a reference to this object so that method calls can be chained together.

Parameters:
target The instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535.

TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case, a health check simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy.

SSL is also specified as SSL: port pair, for example, SSL:5000.

For HTTP/HTTPS, you must include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy.

The total length of the HTTP ping target must be 1024 16-bit Unicode characters or less.

Returns:
A reference to this updated object so that method calls can be chained together.
    public HealthCheck withTarget(String target) {
        this. = target;
        return this;
    }

    
The approximate interval, in seconds, between health checks of an individual instance.

Constraints:
Range: 1 - 300

Returns:
The approximate interval, in seconds, between health checks of an individual instance.
    public Integer getInterval() {
        return ;
    }
    
    
The approximate interval, in seconds, between health checks of an individual instance.

Constraints:
Range: 1 - 300

Parameters:
interval The approximate interval, in seconds, between health checks of an individual instance.
    public void setInterval(Integer interval) {
        this. = interval;
    }
    
    
The approximate interval, in seconds, between health checks of an individual instance.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Range: 1 - 300

Parameters:
interval The approximate interval, in seconds, between health checks of an individual instance.
Returns:
A reference to this updated object so that method calls can be chained together.
    public HealthCheck withInterval(Integer interval) {
        this. = interval;
        return this;
    }

    
The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

Constraints:
Range: 1 - 300

Returns:
The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

    public Integer getTimeout() {
        return ;
    }
    
    
The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

Constraints:
Range: 1 - 300

Parameters:
timeout The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

    public void setTimeout(Integer timeout) {
        this. = timeout;
    }
    
    
The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Range: 1 - 300

Parameters:
timeout The amount of time, in seconds, during which no response means a failed health check.

This value must be less than the Interval value.

Returns:
A reference to this updated object so that method calls can be chained together.
    public HealthCheck withTimeout(Integer timeout) {
        this. = timeout;
        return this;
    }

    
The number of consecutive health check failures required before moving the instance to the Unhealthy state.

Constraints:
Range: 2 - 10

Returns:
The number of consecutive health check failures required before moving the instance to the Unhealthy state.
    public Integer getUnhealthyThreshold() {
        return ;
    }
    
    
The number of consecutive health check failures required before moving the instance to the Unhealthy state.

Constraints:
Range: 2 - 10

Parameters:
unhealthyThreshold The number of consecutive health check failures required before moving the instance to the Unhealthy state.
    public void setUnhealthyThreshold(Integer unhealthyThreshold) {
        this. = unhealthyThreshold;
    }
    
    
The number of consecutive health check failures required before moving the instance to the Unhealthy state.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Range: 2 - 10

Parameters:
unhealthyThreshold The number of consecutive health check failures required before moving the instance to the Unhealthy state.
Returns:
A reference to this updated object so that method calls can be chained together.
    public HealthCheck withUnhealthyThreshold(Integer unhealthyThreshold) {
        this. = unhealthyThreshold;
        return this;
    }

    
The number of consecutive health checks successes required before moving the instance to the Healthy state.

Constraints:
Range: 2 - 10

Returns:
The number of consecutive health checks successes required before moving the instance to the Healthy state.
    public Integer getHealthyThreshold() {
        return ;
    }
    
    
The number of consecutive health checks successes required before moving the instance to the Healthy state.

Constraints:
Range: 2 - 10

Parameters:
healthyThreshold The number of consecutive health checks successes required before moving the instance to the Healthy state.
    public void setHealthyThreshold(Integer healthyThreshold) {
        this. = healthyThreshold;
    }
    
    
The number of consecutive health checks successes required before moving the instance to the Healthy state.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Range: 2 - 10

Parameters:
healthyThreshold The number of consecutive health checks successes required before moving the instance to the Healthy state.
Returns:
A reference to this updated object so that method calls can be chained together.
    public HealthCheck withHealthyThreshold(Integer healthyThreshold) {
        this. = healthyThreshold;
        return this;
    }

    
Returns a string representation of this object; useful for testing and debugging.

Returns:
A string representation of this object.
See also:
java.lang.Object.toString()
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getTarget() != nullsb.append("Target: " + getTarget() + ",");
        if (getInterval() != nullsb.append("Interval: " + getInterval() + ",");
        if (getTimeout() != nullsb.append("Timeout: " + getTimeout() + ",");
        if (getUnhealthyThreshold() != nullsb.append("UnhealthyThreshold: " + getUnhealthyThreshold() + ",");
        if (getHealthyThreshold() != nullsb.append("HealthyThreshold: " + getHealthyThreshold() );
        sb.append("}");
        return sb.toString();
    }
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        
        hashCode = prime * hashCode + ((getTarget() == null) ? 0 : getTarget().hashCode()); 
        hashCode = prime * hashCode + ((getInterval() == null) ? 0 : getInterval().hashCode()); 
        hashCode = prime * hashCode + ((getTimeout() == null) ? 0 : getTimeout().hashCode()); 
        hashCode = prime * hashCode + ((getUnhealthyThreshold() == null) ? 0 : getUnhealthyThreshold().hashCode()); 
        hashCode = prime * hashCode + ((getHealthyThreshold() == null) ? 0 : getHealthyThreshold().hashCode()); 
        return hashCode;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == objreturn true;
        if (obj == nullreturn false;
        if (obj instanceof HealthCheck == falsereturn false;
        HealthCheck other = (HealthCheck)obj;
        
        if (other.getTarget() == null ^ this.getTarget() == nullreturn false;
        if (other.getTarget() != null && other.getTarget().equals(this.getTarget()) == falsereturn false
        if (other.getInterval() == null ^ this.getInterval() == nullreturn false;
        if (other.getInterval() != null && other.getInterval().equals(this.getInterval()) == falsereturn false
        if (other.getTimeout() == null ^ this.getTimeout() == nullreturn false;
        if (other.getTimeout() != null && other.getTimeout().equals(this.getTimeout()) == falsereturn false
        if (other.getUnhealthyThreshold() == null ^ this.getUnhealthyThreshold() == nullreturn false;
        if (other.getUnhealthyThreshold() != null && other.getUnhealthyThreshold().equals(this.getUnhealthyThreshold()) == falsereturn false
        if (other.getHealthyThreshold() == null ^ this.getHealthyThreshold() == nullreturn false;
        if (other.getHealthyThreshold() != null && other.getHealthyThreshold().equals(this.getHealthyThreshold()) == falsereturn false
        return true;
    }
    
    @Override
    public HealthCheck clone() {
        try {
            return (HealthChecksuper.clone();
        
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }
        
    }
}
    
New to GrepCode? Check out our FAQ X