@ Nonnull public HttpHealthCheck addHealthCheck ( String name , String url , int interval , long timeout ) { if ( name == null || name . trim ( ) . length ( ) == 0 ) { throw new IllegalArgumentException ( "The name must not be null or empty." ) ; } if ( url == null || url . trim ( ) . length ( ) == 0 ) { throw new IllegalArgumentException ( "The URL must not be null or empty." ) ; } if ( ! Url . isUrl ( url ) ) { throw new IllegalArgumentException ( url + " is not a valid URL." ) ; } if ( interval < 0 ) { throw new IllegalArgumentException ( "The polling interval must be zero or a positive integer." ) ; } if ( timeout < 0 ) { throw new IllegalArgumentException ( "The timeout must be zero or a positive integer." ) ; } HttpHealthCheck healthCheck = new HttpHealthCheck ( name , url , interval , timeout ) ; healthChecks . add ( healthCheck ) ; return healthCheck ; }
Adds a new health check .