Search in sources :

Example 1 with LoadBanlanceAlgorithm

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

the class LoadBalanceFactory method getNextExtractNode.

public static Node getNextExtractNode(Long pipelineId) throws InterruptedException {
    Pipeline pipeline = ArbitrateConfigUtils.getPipeline(pipelineId);
    LoadBanlanceAlgorithm loadBanlanceAlgorithm = pipeline.getParameters().getLbAlgorithm();
    LoadBalance loadbalance = null;
    if (loadBanlanceAlgorithm.isRandom()) {
        loadbalance = ArbitrateFactory.getInstance(pipelineId, ExtractRandomLoadBanlance.class);
    } else if (loadBanlanceAlgorithm.isRoundRbin()) {
        loadbalance = ArbitrateFactory.getInstance(pipelineId, ExtractRoundRobinLoadBalance.class);
    } else {
        loadbalance = ArbitrateFactory.getInstance(pipelineId, ExtractStickLoadBalance.class);
    }
    // 获取下一个处理节点信息
    Node node = loadbalance.next();
    return node;
}
Also used : Node(com.alibaba.otter.shared.common.model.config.node.Node) LoadBanlanceAlgorithm(com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter.LoadBanlanceAlgorithm) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Example 2 with LoadBanlanceAlgorithm

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

the class LoadBalanceFactory method getNextTransformNode.

public static Node getNextTransformNode(Long pipelineId) throws InterruptedException {
    Pipeline pipeline = ArbitrateConfigUtils.getPipeline(pipelineId);
    LoadBanlanceAlgorithm loadBanlanceAlgorithm = pipeline.getParameters().getLbAlgorithm();
    LoadBalance loadbalance = null;
    if (loadBanlanceAlgorithm.isRandom()) {
        loadbalance = ArbitrateFactory.getInstance(pipelineId, TransformRandomLoadBanlance.class);
    } else if (loadBanlanceAlgorithm.isRoundRbin()) {
        loadbalance = ArbitrateFactory.getInstance(pipelineId, TransformRoundRobinLoadBalance.class);
    } else {
        loadbalance = ArbitrateFactory.getInstance(pipelineId, TransformStickLoadBalance.class);
    }
    // 获取下一个处理节点信息
    Node node = loadbalance.next();
    return node;
}
Also used : Node(com.alibaba.otter.shared.common.model.config.node.Node) LoadBanlanceAlgorithm(com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter.LoadBanlanceAlgorithm) Pipeline(com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)

Aggregations

Node (com.alibaba.otter.shared.common.model.config.node.Node)2 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)2 LoadBanlanceAlgorithm (com.alibaba.otter.shared.common.model.config.pipeline.PipelineParameter.LoadBanlanceAlgorithm)2