All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliyun.dts.subscribe.clients.check.DefaultCheckManager Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package com.aliyun.dts.subscribe.clients.check;

import com.aliyun.dts.subscribe.clients.ConsumerContext;

import java.util.ArrayList;
import java.util.List;

public class DefaultCheckManager implements CheckManager {

    private ConsumerContext consumerContext;

    private List checkerList;

    public DefaultCheckManager(ConsumerContext consumerContext) {
        this.consumerContext = consumerContext;

        checkerList = new ArrayList<>();
    }

    @Override
    public void addCheckItem(SubscribeChecker subscribeChecker) {
        checkerList.add(subscribeChecker);
    }

    @Override
    public CheckResult check() {
        CheckResult checkResult = CheckResult.SUCESS;
        for(SubscribeChecker checker : checkerList) {
            checkResult = checker.check();

            if(!checkResult.isOk()) {
                return checkResult;
            }
        }

        return checkResult;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy