com.alibaba.otter.canal.meta.MemoryMetaManager Java Examples

The following examples show how to use com.alibaba.otter.canal.meta.MemoryMetaManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CanalInstanceWithManager.java    From canal-1.1.3 with Apache License 2.0 5 votes vote down vote up
protected void initMetaManager() {
    logger.info("init metaManager begin...");
    MetaMode mode = parameters.getMetaMode();
    if (mode.isMemory()) {
        metaManager = new MemoryMetaManager();
    } else if (mode.isZookeeper()) {
        metaManager = new ZooKeeperMetaManager();
        ((ZooKeeperMetaManager) metaManager).setZkClientx(getZkclientx());
    } else if (mode.isMixed()) {
        // metaManager = new MixedMetaManager();
        metaManager = new PeriodMixedMetaManager();// 换用优化过的mixed, at
                                                   // 2012-09-11
        // 设置内嵌的zk metaManager
        ZooKeeperMetaManager zooKeeperMetaManager = new ZooKeeperMetaManager();
        zooKeeperMetaManager.setZkClientx(getZkclientx());
        ((PeriodMixedMetaManager) metaManager).setZooKeeperMetaManager(zooKeeperMetaManager);
    } else if (mode.isLocalFile()) {
        FileMixedMetaManager fileMixedMetaManager = new FileMixedMetaManager();
        fileMixedMetaManager.setDataDir(parameters.getDataDir());
        fileMixedMetaManager.setPeriod(parameters.getMetaFileFlushPeriod());
        metaManager = fileMixedMetaManager;
    } else {
        throw new CanalException("unsupport MetaMode for " + mode);
    }

    logger.info("init metaManager end! \n\t load CanalMetaManager:{} ", metaManager.getClass().getName());
}
 
Example #2
Source File: CanalInstanceWithManager.java    From canal with Apache License 2.0 5 votes vote down vote up
protected void initMetaManager() {
    logger.info("init metaManager begin...");
    MetaMode mode = parameters.getMetaMode();
    if (mode.isMemory()) {
        metaManager = new MemoryMetaManager();
    } else if (mode.isZookeeper()) {
        metaManager = new ZooKeeperMetaManager();
        ((ZooKeeperMetaManager) metaManager).setZkClientx(getZkclientx());
    } else if (mode.isMixed()) {
        // metaManager = new MixedMetaManager();
        metaManager = new PeriodMixedMetaManager();// 换用优化过的mixed, at
                                                   // 2012-09-11
        // 设置内嵌的zk metaManager
        ZooKeeperMetaManager zooKeeperMetaManager = new ZooKeeperMetaManager();
        zooKeeperMetaManager.setZkClientx(getZkclientx());
        ((PeriodMixedMetaManager) metaManager).setZooKeeperMetaManager(zooKeeperMetaManager);
    } else if (mode.isLocalFile()) {
        FileMixedMetaManager fileMixedMetaManager = new FileMixedMetaManager();
        fileMixedMetaManager.setDataDir(parameters.getDataDir());
        fileMixedMetaManager.setPeriod(parameters.getMetaFileFlushPeriod());
        metaManager = fileMixedMetaManager;
    } else {
        throw new CanalException("unsupport MetaMode for " + mode);
    }

    logger.info("init metaManager end! \n\t load CanalMetaManager:{} ", metaManager.getClass().getName());
}