本文整理了Java中org.apache.storm.utils.Utils.get()
方法的一些代码示例,展示了Utils.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.get()
方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:get
[英]Get a mapping of the configured supported versions of storm to their actual versions.
[中]获取配置的受支持的storm版本到其实际版本的映射。
代码示例来源:origin: apache/storm
public static int getNumFailed(String stormId) {
synchronized (failed) {
return get(failed, stormId, 0);
}
}
代码示例来源:origin: DigitalPebble/storm-crawler
public static int getInt(Map<String, Object> conf, String key,
int defaultValue) {
Object obj = Utils.get(conf, key, defaultValue);
return Utils.getInt(obj);
}
代码示例来源:origin: apache/storm
public static int getNumAcked(String stormId) {
synchronized (acked) {
return get(acked, stormId, 0);
}
}
代码示例来源:origin: apache/storm
public static int getNumFailed(String stormId) {
synchronized (failed) {
return get(failed, stormId, 0);
}
}
代码示例来源:origin: apache/storm
public static int getNumAcked(String stormId) {
synchronized (acked) {
return get(acked, stormId, 0);
}
}
代码示例来源:origin: apache/storm
public void ack(Object msgId) {
synchronized (acked) {
int curr = get(acked, _id, 0);
acked.put(_id, curr + 1);
}
}
代码示例来源:origin: apache/storm
public void ack(Object msgId) {
synchronized (acked) {
int curr = get(acked, uid, 0);
acked.put(uid, curr + 1);
}
}
代码示例来源:origin: apache/storm
public void fail(Object msgId) {
synchronized (failed) {
int curr = get(failed, uid, 0);
failed.put(uid, curr + 1);
}
}
代码示例来源:origin: apache/storm
public void fail(Object msgId) {
synchronized (failed) {
int curr = get(failed, _id, 0);
failed.put(_id, curr + 1);
}
}
代码示例来源:origin: apache/storm
private void updateTaskCounts(List<Integer> tasks) {
if (_currBatch != null) {
Map<Integer, Integer> taskEmittedTuples = _currBatch.taskEmittedTuples;
for (Integer task : tasks) {
int newCount = Utils.get(taskEmittedTuples, task, 0) + 1;
taskEmittedTuples.put(task, newCount);
}
}
}
}
代码示例来源:origin: apache/storm
private void updateTaskCounts(Object id, List<Integer> tasks) {
synchronized (_tracked) {
TrackingInfo track = _tracked.get(id);
if (track != null) {
Map<Integer, Integer> taskEmittedTuples = track.taskEmittedTuples;
for (Integer task : tasks) {
int newCount = Utils.get(taskEmittedTuples, task, 0) + 1;
taskEmittedTuples.put(task, newCount);
}
}
}
}
}
代码示例来源:origin: apache/storm
public static int getInt(Map map, Object key, int def) {
return ObjectReader.getInt(Utils.get(map, key, def));
}
代码示例来源:origin: apache/storm
public static int getInt(Map map, Object key, int def) {
return ObjectReader.getInt(Utils.get(map, key, def));
}
代码示例来源:origin: apache/storm
/**
* Submits the topology with the name taken from the configuration
**/
protected int submit(Config conf, TopologyBuilder builder) {
String name = (String) Utils.get(conf, Config.TOPOLOGY_NAME, null);
if (StringUtils.isBlank(name)) {
throw new RuntimeException(
"No value found for " + Config.TOPOLOGY_NAME);
}
return submit(name, conf, builder);
}
代码示例来源:origin: apache/storm
/**
* Creates a new {@link CassandraConf} instance.
*
* @param conf The storm configuration.
*/
public CassandraConf(Map<String, Object> conf) {
this.username = (String) Utils.get(conf, CASSANDRA_USERNAME, null);
this.password = (String) Utils.get(conf, CASSANDRA_PASSWORD, null);
this.keyspace = get(conf, CASSANDRA_KEYSPACE);
this.consistencyLevel =
ConsistencyLevel.valueOf((String) Utils.get(conf, CASSANDRA_CONSISTENCY_LEVEL, ConsistencyLevel.ONE.name()));
this.nodes = ((String) Utils.get(conf, CASSANDRA_NODES, "localhost")).split(",");
this.batchSizeRows = ObjectReader.getInt(conf.get(CASSANDRA_BATCH_SIZE_ROWS), 100);
this.port = ObjectReader.getInt(conf.get(CASSANDRA_PORT), 9042);
this.retryPolicyName = (String) Utils.get(conf, CASSANDRA_RETRY_POLICY, DefaultRetryPolicy.class.getSimpleName());
this.reconnectionPolicyBaseMs = getLong(conf.get(CASSANDRA_RECONNECT_POLICY_BASE_MS), 100L);
this.reconnectionPolicyMaxMs = getLong(conf.get(CASSANDRA_RECONNECT_POLICY_MAX_MS), TimeUnit.MINUTES.toMillis(1));
this.poolMaxQueueSize = getInt(conf.get(CASSANDRA_POOL_MAX_SIZE), 256);
this.loadBalancingPolicyName = (String) Utils.get(conf, CASSANDRA_LOAD_BALANCING_POLICY, TokenAwarePolicy.class.getSimpleName());
this.datacenterName = (String) Utils.get(conf, CASSANDRA_DATACENTER_NAME, null);
this.maxRequestPerConnectionLocal = getInt(conf.get(CASSANDRA_MAX_REQUESTS_PER_CON_LOCAL), 1024);
this.maxRequestPerConnectionRemote = getInt(conf.get(CASSANDRA_MAX_REQUESTS_PER_CON_REMOTE), 256);
this.heartbeatIntervalSeconds = getInt(conf.get(CASSANDRA_HEARTBEAT_INTERVAL_SEC), 30);
this.idleTimeoutSeconds = getInt(conf.get(CASSANDRA_IDLE_TIMEOUT_SEC), 60);
this.socketReadTimeoutMillis =
getLong(conf.get(CASSANDRA_SOCKET_READ_TIMEOUT_MS), (long) SocketOptions.DEFAULT_READ_TIMEOUT_MILLIS);
this.socketConnectTimeoutMillis =
getLong(conf.get(CASSANDRA_SOCKET_CONNECT_TIMEOUT_MS), (long) SocketOptions.DEFAULT_CONNECT_TIMEOUT_MILLIS);
}
代码示例来源:origin: apache/storm
@Override
public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) {
_delegate.open(conf, context, new SpoutOutputCollector(new StreamOverrideCollector(collector)));
_outputTasks = new ArrayList<>();
for (String component : Utils.get(context.getThisTargets(),
_coordStream,
new HashMap<String, Grouping>()).keySet()) {
_outputTasks.addAll(context.getComponentTasks(component));
}
_rand = new Random(Utils.secureRandomLong());
}
代码示例来源:origin: apache/storm
public void prepare(Map<String, Object> config, TopologyContext context, OutputCollector collector) {
TimeCacheMap.ExpiredCallback<Object, TrackingInfo> callback = null;
if (_delegate instanceof TimeoutCallback) {
callback = new TimeoutItems();
}
_tracked = new TimeCacheMap<>(context.maxTopologyMessageTimeout(), callback);
_collector = collector;
_delegate.prepare(config, context, new OutputCollector(new CoordinatedOutputCollector(collector)));
for (String component : Utils.get(context.getThisTargets(),
Constants.COORDINATED_STREAM_ID,
new HashMap<String, Grouping>())
.keySet()) {
for (Integer task : context.getComponentTasks(component)) {
_countOutTasks.add(task);
}
}
if (!_sourceArgs.isEmpty()) {
_numSourceReports = 0;
for (Entry<String, SourceArgs> entry : _sourceArgs.entrySet()) {
if (entry.getValue().singleCount) {
_numSourceReports += 1;
} else {
_numSourceReports += context.getComponentTasks(entry.getKey()).size();
}
}
}
}
代码示例来源:origin: apache/storm
for (String component : Utils.get(context.getThisTargets(),
COORD_STREAM(batchGroup),
new HashMap<String, Grouping>()).keySet()) {
代码示例来源:origin: apache/storm
while (outTasks.hasNext()) {
int task = outTasks.next();
int numTuples = Utils.get(track.taskEmittedTuples, task, 0);
_collector.emitDirect(task, Constants.COORDINATED_STREAM_ID, tup, new Values(id, numTuples));
代码示例来源:origin: apache/storm
private boolean finishBatch(TrackedBatch tracked, Tuple finishTuple) {
boolean success = true;
try {
_bolt.finishBatch(tracked.info);
String stream = COORD_STREAM(tracked.info.batchGroup);
for (Integer task : tracked.condition.targetTasks) {
_collector
.emitDirect(task, stream, finishTuple, new Values(tracked.info.batchId, Utils.get(tracked.taskEmittedTuples, task, 0)));
}
if (tracked.delayedAck != null) {
_collector.ack(tracked.delayedAck);
tracked.delayedAck = null;
}
} catch (FailedException e) {
failBatch(tracked, e);
success = false;
}
_batches.remove(tracked.info.batchId.getId());
return success;
}
内容来源于网络,如有侵权,请联系作者删除!