Class HealthCheck.Result

  • Enclosing class:
    HealthCheck

    public static class HealthCheck.Result
    extends Object
    The result of a HealthCheck being run. It can be healthy (with an optional message and optional details) or unhealthy (with either an error message or a thrown exception and optional details).
    • Method Detail

      • isHealthy

        public boolean isHealthy()
        Returns true if the result indicates the component is healthy; false otherwise.
        Returns:
        true if the result indicates the component is healthy
      • getMessage

        public String getMessage()
        Returns any additional message for the result, or null if the result has no message.
        Returns:
        any additional message for the result, or null
      • getError

        public Throwable getError()
        Returns any exception for the result, or null if the result has no exception.
        Returns:
        any exception for the result, or null
      • getTimestamp

        public String getTimestamp()
        Returns the timestamp when the result was created as a formatted String.
        Returns:
        a formatted timestamp
      • getTime

        public long getTime()
        Returns the time when the result was created, in milliseconds since Epoch
        Returns:
        the time when the result was created
      • getDuration

        public long getDuration()
        Returns the duration in milliseconds that the healthcheck took to run
        Returns:
        the duration
      • setDuration

        public void setDuration​(long duration)
        Sets the duration in milliseconds. This will indicate the time it took to run the individual healthcheck
        Parameters:
        duration - The duration in milliseconds
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object