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

The following examples show how to use backtype.storm.utils.Utils#getString() . 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: MetricUploader.java    From jstorm with 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());
                insertFilters.add(m);
            } catch (Exception ignored) {
                logger.warn("Bad meta type:{}", metaType);
            }
        }
    }
}
 
Example 2
Source File: BatchCache.java    From jstorm with 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";
    else
        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();
    }
    LOG.info("Cache config: isExactlyOnce={}, cacheType={}", isExactlyOnceMode, cacheType);
}
 
Example 3
Source File: SerializerFactory.java    From jstorm with 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
Source File: RocksDbKvStoreManagerFactory.java    From jstorm with Apache License 2.0 5 votes vote down vote up
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))
        dfs.mkdir(dfsDbPath);
    if (!dfs.exist(dfsCheckpointPath))
        dfs.mkdir(dfsCheckpointPath);
    LOG.info("Finished init HDFS: dataDir={}, checkpointDir={}", dfsDbPath, dfsCheckpointPath);
}
 
Example 5
Source File: KvStoreManagerFactory.java    From jstorm with 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);
}