当前位置: 首页>>代码示例>>Java>>正文


Java ConfigDataHandlerFactory类代码示例

本文整理汇总了Java中com.taobao.tddl.config.ConfigDataHandlerFactory的典型用法代码示例。如果您正苦于以下问题:Java ConfigDataHandlerFactory类的具体用法?Java ConfigDataHandlerFactory怎么用?Java ConfigDataHandlerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConfigDataHandlerFactory类属于com.taobao.tddl.config包,在下文中一共展示了ConfigDataHandlerFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doInit

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
@Override
public void doInit() {
    String dataId = null;
    ConfigDataHandlerFactory factory = null;
    // 优先从文件获取
    if (sequenceFile == null) {
        dataId = TDDL5_SEQUENCE_DATA_ID.format(new Object[] { appName });
        factory = ConfigDataHandlerCity.getFactory(appName, unitName);
    } else {
        factory = ConfigDataHandlerCity.getFileFactory(appName);
        dataId = sequenceFile;
    }

    sequenceCdh = factory.getConfigDataHandler(dataId, new SequenceConfigDataListener());
    String data = sequenceCdh.getData();

    if (TStringUtil.isEmpty(data)) {
        logger.warn("sequence is null, dataId is " + dataId);
        return;
    }

    parseSequence(data);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:24,代码来源:SequenceManager.java

示例2: getFactory

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
/**
 * @param appName
 * @param unitName
 * @param localValues 从本地配置文件里读出来的值,优先使用这里面的
 * @return
 */
public static ConfigDataHandlerFactory getFactory(String appName, String unitName, Map<String, String> localValues) {
    if (localValues == null) {
        return getFactory(appName, unitName);
    }
    return new LocalFirstConfigDataHandlerFactory(getFactory(appName, unitName), localValues);

}
 
开发者ID:loye168,项目名称:tddl5,代码行数:14,代码来源:ConfigDataHandlerCity.java

示例3: LocalFirstConfigDataHandlerFactory

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
public LocalFirstConfigDataHandlerFactory(ConfigDataHandlerFactory delegateFactory, Map<String, String> localValues){
    this.delegateFactory = delegateFactory;
    this.localValues = localValues;
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:5,代码来源:LocalFirstConfigDataHandlerFactory.java

示例4: getSimpleFactory

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
public static ConfigDataHandlerFactory getSimpleFactory() {
    return new UnitConfigDataHandlerFactory();
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:4,代码来源:ConfigDataHandlerCity.java

示例5: getPreHeatFactory

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
public static ConfigDataHandlerFactory getPreHeatFactory(String appName, String unitName) {
    return new UnitConfigDataHandlerFactory(appName, unitName);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:4,代码来源:ConfigDataHandlerCity.java

示例6: getFileFactory

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
public static ConfigDataHandlerFactory getFileFactory(String appName) {
    return new FileConfigDataHandlerFactory("", appName);
}
 
开发者ID:loye168,项目名称:tddl5,代码行数:4,代码来源:ConfigDataHandlerCity.java

示例7: doInit

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
protected void doInit() throws TddlException {
    super.doInit();
    ss = new ConcurrentHashMap<String, TableMeta>();

    if (this.appName == null) {
        logger.warn("schema appname is not assigned");
    }

    if (this.schemaFilePath == null) {
        logger.warn("schema file is not assigned");
    }

    if (appName == null && schemaFilePath == null) {
        return;
    }

    ConfigDataHandlerFactory factory = null;
    String dataId = null;

    // 优先从文件获取
    if (schemaFilePath == null) {
        dataId = TDDL5_SCHEMA_DATA_ID.format(new Object[] { appName });
        factory = ConfigDataHandlerCity.getFactory(appName, unitName);
    } else {
        factory = ConfigDataHandlerCity.getFileFactory(appName);
        dataId = schemaFilePath;
    }

    schemaCdh = factory.getConfigDataHandler(dataId, new SchemaConfigDataListener(this));

    String data = schemaCdh.getData(ConfigDataHandler.GET_DATA_TIMEOUT,
        ConfigDataHandler.FIRST_CACHE_THEN_SERVER_STRATEGY);

    if (data == null) {
        schemaCdh.destory();
        // 尝试找一下andor的版本配置
        dataId = ANDOR_SCHEMA_DATA_ID.format(new Object[] { appName });
        schemaCdh = factory.getConfigDataHandler(dataId, new SchemaConfigDataListener(this));
        data = schemaCdh.getData(ConfigDataHandler.GET_DATA_TIMEOUT,
            ConfigDataHandler.FIRST_CACHE_THEN_SERVER_STRATEGY);

    }

    if (data == null) {
        logger.warn(schemaNullError.format(new Object[] { appName, unitName, schemaFilePath, dataId }));
        return;
    }

    InputStream sis = null;
    try {
        sis = new ByteArrayInputStream(data.getBytes());
        List<TableMeta> schemaList = TableMetaParser.parse(sis);

        this.ss.clear();

        for (TableMeta table : schemaList) {
            this.putTable(table.getTableName(), table);
        }

        logger.warn("table fetched:");
        logger.warn(this.ss.keySet().toString());
    } catch (Exception e) {
        logger.error("table parser error, schema file is:\n" + data, e);
        throw new TddlRuntimeException(e);
    } finally {
        IOUtils.closeQuietly(sis);
    }

}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:70,代码来源:StaticSchemaManager.java

示例8: getPreHeatFactory

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
public static ConfigDataHandlerFactory getPreHeatFactory(String appName, String unitName) {
    return new UnitConfigDataHandlerFactory(unitName, appName);
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:4,代码来源:ConfigDataHandlerCity.java

示例9: getFileFactory

import com.taobao.tddl.config.ConfigDataHandlerFactory; //导入依赖的package包/类
public static ConfigDataHandlerFactory getFileFactory(String appName) {
    return new FileConfigDataHandlerFactory("", appName, null);
}
 
开发者ID:beebeandwer,项目名称:TDDL,代码行数:4,代码来源:ConfigDataHandlerCity.java


注:本文中的com.taobao.tddl.config.ConfigDataHandlerFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。