2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.components.distribution.engine;
23 import org.openecomp.sdc.common.log.wrappers.Logger;
25 import java.util.concurrent.Callable;
27 public class UebHealthCheckCall implements Callable<Boolean> {
29 CambriaHandler cambriaHandler = new CambriaHandler();
34 private static final Logger healthLogger = Logger.getLogger(DistributionEngineClusterHealth.UEB_HEALTH_LOG_CONTEXT);
36 private static final Logger logger = Logger.getLogger(UebHealthCheckCall.class.getName());
38 public UebHealthCheckCall(String server, String publicApiKey) {
41 this.publicApiKey = publicApiKey;
45 public Boolean call() {
47 healthLogger.trace("Going to run health check towards ueb server {}", server);
49 boolean result = false;
50 CambriaErrorResponse cambriaErrorResponse = cambriaHandler.getApiKey(server, publicApiKey);
52 logger.debug("After running Health check towards ueb server {}. Result is {}", server, cambriaErrorResponse);
54 if (cambriaErrorResponse.httpCode < CambriaErrorResponse.HTTP_INTERNAL_SERVER_ERROR) {
55 logger.debug("After running Health check towards ueb server {}. Error code is {}. Set result to true", server, cambriaErrorResponse.httpCode);
59 logger.debug("After running Health check towards ueb server {}. Error code is {}. Set result to false", server, cambriaErrorResponse.httpCode);
62 healthLogger.trace("Result after running health check towards ueb server {} is {}. Returned result is {} ", server, cambriaErrorResponse, result);
67 public String getServer() {
71 public CambriaHandler getCambriaHandler() {
72 return cambriaHandler;
75 public void setCambriaHandler(CambriaHandler cambriaHandler) {
76 this.cambriaHandler = cambriaHandler;