Search in sources :

Example 1 with NodeTaskListener

use of com.alibaba.otter.node.common.config.NodeTaskListener in project otter by alibaba.

the class NodeTaskServiceImpl method notifyListener.

private synchronized boolean notifyListener() {
    boolean result = true;
    List<NodeTask> incNodeTask = new ArrayList<NodeTask>(incTasks);
    if (CollectionUtils.isEmpty(listeners) == false) {
        for (NodeTaskListener listener : listeners) {
            result &= listener.process(incNodeTask);
        }
        if (result) {
            mergeIncNodeTasks();
        } else {
            // 清除本次的增量数据
            incTasks.clear();
            if (logger.isInfoEnabled()) {
                logger.info("##notify listener error {}", printNodeTasks(incNodeTask));
            }
        }
    }
    return result;
}
Also used : NodeTaskListener(com.alibaba.otter.node.common.config.NodeTaskListener) ArrayList(java.util.ArrayList) NodeTask(com.alibaba.otter.node.common.config.model.NodeTask)

Aggregations

NodeTaskListener (com.alibaba.otter.node.common.config.NodeTaskListener)1 NodeTask (com.alibaba.otter.node.common.config.model.NodeTask)1 ArrayList (java.util.ArrayList)1