Search in sources :

Example 1 with ArbitrateMode

use of com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter.ArbitrateMode in project otter by alibaba.

the class AbstractDelegateArbitrateEvent method chooseMode.

public ArbitrateMode chooseMode(Long pipelineId) {
    Pipeline pipeline = ArbitrateConfigUtils.getPipeline(pipelineId);
    ArbitrateMode arbitrateMode = pipeline.getParameters().getArbitrateMode();
    // 重新计算arbitrateMode
    ArbitrateMode result = null;
    switch(arbitrateMode) {
        case AUTOMATIC:
            // 2. 如果s/e由一组机器,t/l由另一组机器提供服务,则选择rpc模式
            if (containAll(pipeline.getSelectNodes(), pipeline.getExtractNodes()) && containAll(pipeline.getSelectNodes(), pipeline.getLoadNodes())) {
                result = ArbitrateMode.MEMORY;
            } else {
                result = ArbitrateMode.RPC;
            }
            break;
        default:
            result = arbitrateMode;
            break;
    }
    return result;
}
Also used : ArbitrateMode(com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter.ArbitrateMode) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Aggregations

Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)1 ArbitrateMode (com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter.ArbitrateMode)1