Examples of ITargetHealthCheckService


Examples of com.alu.e3.gateway.targethealthcheck.ITargetHealthCheckService

        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("Registering Context {} ({} TargetHosts)", context.getId(), context.getTargetHosts().size());
        }
       
        // Store requested HealthCheck service for later use
        ITargetHealthCheckService healthCheckService = null;
        String healthCheckServiceName = null;
       
        LoadBalancing lbConfig = context.getLoadBalancing();
        if(lbConfig.getTargetHealthCheck() != null) {
          healthCheckServiceName = lbConfig.getTargetHealthCheck().getType();
        }
       
        if(healthCheckServiceName != null) {
          if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Will use HealthCheck service ", healthCheckServiceName);
          }
           
          // Getting corresponding HealthCheck Service
          healthCheckService = targetHealthCheckServices.get(healthCheckServiceName);
          if(healthCheckService != null) {
            if (LOGGER.isDebugEnabled()) {
              LOGGER.debug("Found a HealthCheckService ({}) for this name: {}", healthCheckService.getClass().getName(), healthCheckServiceName);
            }
          } else {
            if (LOGGER.isDebugEnabled()) {
              LOGGER.debug("No HealthCheckService found for this name: {}", healthCheckServiceName);
            }
          }
        } else {
          if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Will NOT use HealthCheck service for following targets");
          }
        }
       
       
        // For each TargetHost, check if there is already a corresponding ManagedTargetHost
        for(TargetHost targetHost : context.getTargetHosts()) {
         
          /*
           * If the api has its own proxy settings, they were automatically set by the DataManager while loading the api. Nothing to do.
           * If the api uses global proxy settings,  we have to retrieve a reference on this shared instance
           */
         
          targetHost.setForwardProxy( api.isUseGlobalProxy() ? globalForwardProxy : api.getForwardProxy() );
         
          // Using a "hash differentiation string":
          // We need to take into account the HealthCheckService associated to a TargetHost
          // Ex: API #1 (http://www.apple.com|Ping), API #2 (http://www.apple.com|Telnet), API #3 (http://www.apple.com|Ping)
          // API #1 and #3 must have the same "Managed target" and #2 another one
          // (One HealthCheck service may check for a specific functionality status)
          String hashDifferentiationString = healthCheckServiceName == null ? "" : healthCheckServiceName;
          String managedReference = ManagedTargetHost.computeTargetHostHash(targetHost, hashDifferentiationString);
                 
          ManagedTargetHost target = targets.get(managedReference);   
          if(target == null) {
            if (LOGGER.isDebugEnabled()) {
              LOGGER.debug("No corresponding ManagedTarget, creating a new one");
            }
           
            // Instantiating and remembering managed target
            target = new ManagedTargetHost(targetHost);
            target.setReference(managedReference);
            targets.put(managedReference, target);
           
            // Registering managed target on health check service
            if(healthCheckService != null) {
              if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Target #{} registered on HealthCheck service {}", managedReference, healthCheckService.getName());
              }
             
              healthCheckService.registerTarget(target);
              target.setHealthCheckService(healthCheckService);
            } else {
              if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Target #{} not registered on HealthCheck service");
              }
View Full Code Here

Examples of com.alu.e3.gateway.targethealthcheck.ITargetHealthCheckService

      if(usage == 0) {
        if (LOGGER.isDebugEnabled()) {
          LOGGER.debug("Usage == 0, removing target #{}", targetHostReference);
        }
        // Unregistering it from the HealthCheck service
        ITargetHealthCheckService healthCheckService = target.getHealthCheckService();
        if(healthCheckService != null) {
          if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Unregistering target #{} from HealthCheckService {}", targetHostReference, healthCheckService.getName());
          }
          healthCheckService.unregisterTarget(target);
          target.setHealthCheckService(null);
        }

        // Removing it from the local targets map
        targets.remove(targetHostReference);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.