Java Code Examples for backtype.storm.utils.Utils#getString()

The following examples show how to use backtype.storm.utils.Utils#getString() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: jstorm   File:    License: Apache License 2.0 6 votes vote down vote up
public void parseInsertFilters(Map conf, String key) {
    String insertMetaTypes = Utils.getString(conf.get(key), "NONE");
    if ("ALL".equals(insertMetaTypes)) {
        Collections.addAll(insertFilters, MetaType.values());
    } else if (!"NONE".equals(insertMetaTypes)) {
        String[] metaTypes = insertMetaTypes.split(",");
        for (String metaType : metaTypes) {
            try {
                MetaType m = MetaType.valueOf(MetaType.class, metaType.trim());
            } catch (Exception ignored) {
                logger.warn("Bad meta type:{}", metaType);
Example 2
Source Project: jstorm   File:    License: Apache License 2.0 6 votes vote down vote up
public BatchCache(TopologyContext context, StormTopology sysTopology, boolean isIntraWorker) {
    this.context = context;
    this.stormConf = context.getStormConf();

    this.isExactlyOnceMode = JStormUtils.parseBoolean(stormConf.get("transaction.exactly.once.mode"), true);

    this.pendingBatches = new ConcurrentHashMap<>();

    serializer = new KryoTupleSerializer(stormConf, sysTopology);
    deserializer = new KryoTupleDeserializer(stormConf, context, sysTopology);

    String cacheDir = context.getWorkerIdDir() + "/transactionCache/task-" + context.getThisTaskId();
    if (isIntraWorker)
        cacheDir += "/intra";
        cacheDir += "/inter";
    String cacheType = Utils.getString(stormConf.get("transaction.exactly.cache.type"), "default");
    if (cacheType.equalsIgnoreCase("rocksDb")) {
        cacheOperator = new RocksDbCacheOperator(context, cacheDir);
    } else {
        cacheOperator = new DefaultCacheOperator();
    }"Cache config: isExactlyOnce={}, cacheType={}", isExactlyOnceMode, cacheType);
Example 3
Source Project: jstorm   File:    License: Apache License 2.0 5 votes vote down vote up
public static <T> Serializer<T> createSerailzer(Map conf) {
    String serializerType = Utils.getString(conf.get(ConfigExtension.TOPOLOGY_SERIALIZER_TYPE), "kryo");
    if (serializerType.equals("java")) {
        return new JavaSerializer<T>();
    } else if (serializerType.equals("kryo")) {
        return new KryoSerializer<T>();
    } else {
        LOG.error("Unknown serializer type: {}", serializerType);
        return null;
Example 4
private void initDfsEnv(Map conf) throws IOException {
    dfs = DfsFactory.getHdfsInstance(conf);
    String topologyName = Utils.getString(conf.get(Config.TOPOLOGY_NAME));
    dfsDbPath = String.format("%s/%s/rocksdb", dfs.getBaseDir(), topologyName + "/rocksDb/" + storeName);;
    dfsCheckpointPath = dfsDbPath + "/checkpoint";
    if (!dfs.exist(dfsDbPath))
    if (!dfs.exist(dfsCheckpointPath))
        dfs.mkdir(dfsCheckpointPath);"Finished init HDFS: dataDir={}, checkpointDir={}", dfsDbPath, dfsCheckpointPath);
Example 5
Source Project: jstorm   File:    License: Apache License 2.0 4 votes vote down vote up
private static KvStoreType getKvStoreType(Map conf) {
    String type = Utils.getString(conf.get(ConfigExtension.KV_STORE_TYPE), KvStoreType.rocksdb.toString());
    return KvStoreType.valueOf(type);