Search in sources :

Example 1 with OuterClientService

use of com.ctrip.xpipe.api.migration.OuterClientService in project x-pipe by ctripcorp.

the class MigrationCheckingState method doCheckClientService.

private boolean doCheckClientService(MigrationCluster migrationCluster) {
    String clusterName = migrationCluster.clusterName();
    OuterClientService outerClientService = migrationCluster.getOuterClientService();
    String failMesage = "";
    logger.info("[doCheckClientService]{}", clusterName);
    try {
        OuterClientService.ClusterInfo clusterInfo = outerClientService.getClusterInfo(clusterName);
        // simple check
        if (clusterInfo != null && clusterInfo.getGroups() != null && clusterInfo.getGroups().size() > 0) {
            return true;
        }
        failMesage = String.format("%s FAIL, cluster:%s, info empty:%s", outerClientService.serviceName(), clusterName, clusterInfo);
    } catch (Exception e) {
        logger.error("[doCheckClientService]" + clusterName, e);
        failMesage = String.format("%s FAIL, cluster:%s, error message:%s", outerClientService.serviceName(), clusterName, e.getMessage());
    }
    migrationCluster.markCheckFail(failMesage);
    return false;
}
Also used : OuterClientService(com.ctrip.xpipe.api.migration.OuterClientService)

Aggregations

OuterClientService (com.ctrip.xpipe.api.migration.OuterClientService)1