Package com.alibaba.otter.shared.common.model.config

Examples of com.alibaba.otter.shared.common.model.config.ConfigException


                                String[] names = StringUtils.split(fullNameColumn.getColumnValue(), ".");
                                if (names.length >= 2) {
                                    dataMedia = ConfigHelper.findSourceDataMedia(pipeline, names[0], names[1]);
                                    eventData.setTableId(dataMedia.getId());
                                } else {
                                    throw new ConfigException("no such DataMedia " + names);
                                }
                            }
                        } else {
                            // 如果指定了tableId,需要按照tableId进行严格查找,如果没找到,那说明不需要进行同步
                            dataMedia = ConfigHelper.findDataMedia(pipeline,
View Full Code Here


    }

    public Node currentNode() {
        Node node = nodeCache.get(nid);
        if (node == null) {
            throw new ConfigException("nid:" + nid + " in manager[" + nodeCommmunicationClient.getManagerAddress()
                                      + "]is not found!");
        }

        return node;
    }
View Full Code Here

            if (pipeline.getId().equals(pipelineId)) {
                return pipeline;
            }
        }

        throw new ConfigException("no pipeline for pipelineId[" + pipelineId + "]");
    }
View Full Code Here

    public void afterPropertiesSet() throws Exception {
        // 获取一下nid变量
        String nid = System.getProperty(NID_NAME);
        if (StringUtils.isEmpty(nid)) {
            throw new ConfigException("nid is not set!");
        }

        this.nid = Long.valueOf(nid);

        channelMapping = new MapMaker().makeComputingMap(new Function<Long, Long>() {

            public Long apply(Long pipelineId) {
                // 处理下pipline -> channel映射关系不存在的情况
                FindChannelEvent event = new FindChannelEvent();
                event.setPipelineId(pipelineId);
                try {
                    Object obj = nodeCommmunicationClient.callManager(event);
                    if (obj != null && obj instanceof Channel) {
                        Channel channel = (Channel) obj;
                        updateMapping(channel, pipelineId);// 排除下自己
                        channelCache.put(channel.getId(), channel);// 更新下channelCache
                        return channel.getId();
                    }
                } catch (Exception e) {
                    logger.error("call_manager_error", event.toString(), e);
                }

                throw new ConfigException("No Such Channel by pipelineId[" + pipelineId + "]");
            }
        });

        nodeCache = new RefreshMemoryMirror<Long, Node>(timeout, new ComputeFunction<Long, Node>() {

            public Node apply(Long key, Node oldValue) {
                FindNodeEvent event = new FindNodeEvent();
                event.setNid(key);
                try {
                    Object obj = nodeCommmunicationClient.callManager(event);
                    if (obj != null && obj instanceof Node) {
                        return (Node) obj;
                    } else {
                        throw new ConfigException("No Such Node by id[" + key + "]");
                    }
                } catch (Exception e) {
                    logger.error("call_manager_error", event.toString(), e);
                }
                // 其他情况直接返回内存中的旧值
                return oldValue;
            }
        });

        channelCache = new RefreshMemoryMirror<Long, Channel>(timeout, new ComputeFunction<Long, Channel>() {

            public Channel apply(Long key, Channel oldValue) {
                FindChannelEvent event = new FindChannelEvent();
                event.setChannelId(key);
                try {
                    Object obj = nodeCommmunicationClient.callManager(event);
                    if (obj != null && obj instanceof Channel) {
                        updateMapping((Channel) obj, null);// 排除下自己
                        return (Channel) obj;
                    } else {
                        throw new ConfigException("No Such Channel by pipelineId[" + key + "]");
                    }
                } catch (Exception e) {
                    logger.error("call_manager_error", event.toString(), e);
                }
                // 其他情况直接返回内存中的旧值
View Full Code Here

        Pattern pattern = null;
        PatternCompiler pc = new Perl5Compiler();
        try {
            pattern = pc.compile("havana_us_.*", Perl5Compiler.DEFAULT_MASK);
        } catch (MalformedPatternException e) {
            throw new ConfigException(e);
        }
        boolean ismatch = matcher.matches("havana_us_0001", pattern);
        System.out.println(ismatch);
    }
View Full Code Here

    private void initNid() {
        // 获取一下nid变量
        String nid = System.getProperty(OtterConstants.NID_NAME);
        if (StringUtils.isEmpty(nid)) {
            throw new ConfigException("nid is not set!");
        }
        logger.info("INFO ## the nodeId = {}", nid);
        checkNidVaild(nid);
        arbitrateManageService.nodeEvent().init(Long.valueOf(nid));
        // 添加session expired处理
View Full Code Here

                                String[] names = StringUtils.split(fullNameColumn.getColumnValue(), ".");
                                if (names.length >= 2) {
                                    dataMedia = ConfigHelper.findSourceDataMedia(pipeline, names[0], names[1]);
                                    eventData.setTableId(dataMedia.getId());
                                } else {
                                    throw new ConfigException("no such DataMedia " + names);
                                }
                            }
                        } else {
                            // 如果指定了tableId,需要按照tableId进行严格查找,如果没找到,那说明不需要进行同步
                            dataMedia = ConfigHelper.findDataMedia(pipeline,
View Full Code Here

                                }
                            });
                        }
                        return value;
                    } else {
                        throw new ConfigException("No Such dataId[" + key + "]");
                    }
                } catch (Exception e) {
                    logger.error("call_manager_error", event.toString(), e);
                }
                // 其他情况直接返回内存中的旧值
View Full Code Here

                                String[] names = StringUtils.split(fullNameColumn.getColumnValue(), ".");
                                if (names.length >= 2) {
                                    dataMedia = ConfigHelper.findSourceDataMedia(pipeline, names[0], names[1]);
                                    eventData.setTableId(dataMedia.getId());
                                } else {
                                    throw new ConfigException("no such DataMedia " + names);
                                }
                            }
                        } else {
                            // 如果指定了tableId,需要按照tableId进行严格查找,如果没找到,那说明不需要进行同步
                            dataMedia = ConfigHelper.findDataMedia(pipeline,
View Full Code Here

            if (pipeline.getId().equals(pipelineId)) {
                return pipeline;
            }
        }

        throw new ConfigException("no pipeline for pipelineId[" + pipelineId + "]");
    }
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.common.model.config.ConfigException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.