<commit_before>package com.netflix.karyon.server;

import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.netflix.config.ConfigurationManager;
import com.netflix.karyon.server.eureka.AsyncHealthCheckInvocationStrategy;
import com.netflix.karyon.server.eureka.HealthCheckInvocationStrategy;
import com.netflix.karyon.spi.HealthCheckHandler;
import com.netflix.karyon.spi.PropertyNames;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A guice module that configures only the implementations of {@link HealthCheckHandler} and
 * {@link HealthCheckInvocationStrategy} based on the defined properties. This can be used as a standalone module if
 * only health check implementations are to be bound.
 *
 * @author <NAME>
 */
public class HealthCheckModule extends AbstractModule {

    private static final Logger logger = LoggerFactory.getLogger(HealthCheckModule.class);

    @Override
    protected void configure() {

        bindHealthCheckStrategy();

        bindHealthCheckHandler();
    }

    protected void bindHealthCheckStrategy() {
        boolean bound = bindACustomClass(binder(), PropertyNames.HEALTH_CHECK_STRATEGY,
                HealthCheckHandler.class,
                "No health check invocation strategy specified, using the default strategy %s. In order to override " +
                "this behavior you provide an implementation of %s and specify the fully qualified class name of " +
                "the implementation in the property %s", AsyncHealthCheckInvocationStrategy.class.getName(),
                HealthCheckInvocationStrategy.class.getName(), PropertyNames.HEALTH_CHECK_STRATEGY);

        if(!bound) {
            binder().bind(HealthCheckInvocationStrategy.class).to(AsyncHealthCheckInvocationStrategy.class);
        }
    }

    protected void bindHealthCheckHandler() {
        boolean bound = bindACustomClass(binder(), PropertyNames.HEALTH_CHECK_HANDLER_CLASS_PROP_NAME,
                HealthCheckHandler.class,<commit_msg>Fixing custom health check invocation strategy<commit_after>package com.netflix.karyon.server;

import com.google.inject.AbstractModule;
import com.google.inject.Binder;
import com.netflix.config.ConfigurationManager;
import com.netflix.karyon.server.eureka.AsyncHealthCheckInvocationStrategy;
import com.netflix.karyon.server.eureka.HealthCheckInvocationStrategy;
import com.netflix.karyon.spi.HealthCheckHandler;
import com.netflix.karyon.spi.PropertyNames;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A guice module that configures only the implementations of {@link HealthCheckHandler} and
 * {@link HealthCheckInvocationStrategy} based on the defined properties. This can be used as a standalone module if
 * only health check implementations are to be bound.
 *
 * @author <NAME>
 */
public class HealthCheckModule extends AbstractModule {

    private static final Logger logger = LoggerFactory.getLogger(HealthCheckModule.class);

    @Override
    protected void configure() {

        bindHealthCheckStrategy();

        bindHealthCheckHandler();
    }

    protected void bindHealthCheckStrategy() {
        boolean bound = bindACustomClass(binder(), PropertyNames.HEALTH_CHECK_STRATEGY,
                HealthCheckInvocationStrategy.class,
                "No health check invocation strategy specified, using the default strategy %s. In order to override " +
                "this behavior you provide an implementation of %s and specify the fully qualified class name of " +
                "the implementation in the property %s", AsyncHealthCheckInvocationStrategy.class.getName(),
                HealthCheckInvocationStrategy.class.getName(), PropertyNames.HEALTH_CHECK_STRATEGY);

        if(!bound) {
            binder().bind(HealthCheckInvocationStrategy.class).to(AsyncHealthCheckInvocationStrategy.class);
        }
    }

    protected void bindHealthCheckHandler() {
        boolean bound = bindACustomClass(binder(), PropertyNames.HEALTH_CHECK_HANDLER_CLASS_PROP_NAME,
                HealthCheckHandler.class,
{'fraction_non_alphanumeric': 0.0756385068762279, 'fraction_numerical': 0.0009823182711198428, 'mean_word_length': 3.9670731707317075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2018040', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1024, 'n_words': 270}