org.apache.storm.utils.Utils.getInt()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(195)

本文整理了Java中org.apache.storm.utils.Utils.getInt()方法的一些代码示例,展示了Utils.getInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getInt()方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:getInt

Utils.getInt介绍

暂无

代码示例

代码示例来源:origin: org.apache.storm/storm-core

public static Integer getInt(Object o) {
  Integer result = getInt(o, null);
  if (null == result) {
    throw new IllegalArgumentException("Don't know how to convert null to int");
  }
  return result;
}

代码示例来源:origin: org.apache.storm/storm-core

public Emitter(Map conf) {
  Object c = conf.get(Config.TOPOLOGY_MAX_SPOUT_PENDING);
  if(c==null) _maxSpoutPending = 1;
  else _maxSpoutPending = Utils.getInt(c);
}

代码示例来源:origin: org.apache.storm/storm-core

public Emitter(Map conf) {
  Object c = conf.get(Config.TOPOLOGY_MAX_SPOUT_PENDING);
  if(c==null) _maxSpoutPending = 1;
  else _maxSpoutPending = Utils.getInt(c);
}

代码示例来源:origin: org.apache.storm/storm-core

public Integer getSocketTimeOut(Map conf) {
  if (_socketTimeoutConf == null) {
    return null;
  }
  return Utils.getInt(conf.get(_socketTimeoutConf));
}

代码示例来源:origin: org.apache.storm/storm-core

public int getPort(Map conf) {
  return Utils.getInt(conf.get(_portConf));
}

代码示例来源:origin: org.apache.storm/storm-core

public static Integer getGangliaTMax(Map reporterConf) {
  return Utils.getInt(reporterConf.get(GANGLIA_TMAX), null);
}

代码示例来源:origin: org.apache.storm/storm-core

/**
 * @deprecated  As SimpleTrasportPlugin is deprecated, no other thrift transport plugin uses this method.
 * @param conf
 * @return
 */
@Deprecated
public int getMaxBufferSize(Map conf) {
  return Utils.getInt(conf.get(_buffConf));
}

代码示例来源:origin: org.apache.storm/storm-core

public static long getReportPeriod(Map reporterConf) {
  return Utils.getInt(reporterConf.get(REPORT_PERIOD), 10).longValue();
}

代码示例来源:origin: org.apache.storm/storm-kafka

private CuratorFramework newCurator(Map stateConf) throws Exception {
  Integer port = (Integer) stateConf.get(Config.TRANSACTIONAL_ZOOKEEPER_PORT);
  String serverPorts = "";
  for (String server : (List<String>) stateConf.get(Config.TRANSACTIONAL_ZOOKEEPER_SERVERS)) {
    serverPorts = serverPorts + server + ":" + port + ",";
  }
  return CuratorFrameworkFactory.newClient(serverPorts,
      Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT)),
      Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT)),
      new RetryNTimes(Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)),
          Utils.getInt(stateConf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL))));
}

代码示例来源: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: org.apache.storm/storm-core

/**
 * initializes member variables
 */
private void initConfigs() {
  this.topologyWorkerMaxHeapSize = Utils.getDouble(this.topologyConf.get(Config.TOPOLOGY_WORKER_MAX_HEAP_SIZE_MB), null);
  this.topologyPriority = Utils.getInt(this.topologyConf.get(Config.TOPOLOGY_PRIORITY), null);
  assert this.topologyWorkerMaxHeapSize != null;
  assert this.topologyPriority != null;
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
public boolean setClient(Map conf, NimbusClient client) {
  if (this.client != null) {
    this.client.close();
  }
  this.client = client;
  if (conf != null) {
    this.bufferSize = Utils.getInt(conf.get(Config.STORM_BLOBSTORE_INPUTSTREAM_BUFFER_SIZE_BYTES), bufferSize);
  }
  return true;
}

代码示例来源:origin: org.apache.storm/storm-core

/**
 * Invoked once immediately after construction
 * @param storm_conf Storm configuration
 */
@Override
public void prepare(Map storm_conf) {
  int timeout = Utils.getInt(storm_conf.get(Config.STORM_GROUP_MAPPING_SERVICE_CACHE_DURATION_SECS));
  cachedGroups = new TimeCacheMap<>(timeout);
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
public void prepare(Map conf) {
  this.client = NimbusClient.getConfiguredClient(conf);
  if (conf != null) {
    this.bufferSize = Utils.getInt(conf.get(Config.STORM_BLOBSTORE_INPUTSTREAM_BUFFER_SIZE_BYTES), bufferSize);
  }
}

代码示例来源:origin: org.apache.storm/storm-core

private  boolean  isWorkerHbTimedOutImpl(int now, LSWorkerHeartbeat whb, Map<String, Object> conf) {
  return (now - whb.get_time_secs()) > Utils.getInt(conf.get(Config.SUPERVISOR_WORKER_TIMEOUT_SECS));
}

代码示例来源:origin: stackoverflow.com

public static void main(String[] args)  throws Exception{
   Utils u = new Tutorial4();
   u.getInt("2");
 }

代码示例来源:origin: org.apache.flink/flink-storm

/**
 * Returns a {@link FlinkClient} that uses the configured {@link Config#NIMBUS_HOST} and {@link
 * Config#NIMBUS_THRIFT_PORT} as JobManager address.
 *
 * @param conf
 *         Configuration that contains the jobmanager's hostname and port.
 * @return A configured {@link FlinkClient}.
 */
@SuppressWarnings("rawtypes")
public static FlinkClient getConfiguredClient(final Map conf) {
  final String nimbusHost = (String) conf.get(Config.NIMBUS_HOST);
  final int nimbusPort = Utils.getInt(conf.get(Config.NIMBUS_THRIFT_PORT)).intValue();
  return new FlinkClient(conf, nimbusHost, nimbusPort);
}

代码示例来源:origin: org.apache.storm/storm-core

private int getMemOnHeap(WorkerResources resources) {
  int memOnheap = 0;
  if (resources != null && resources.is_set_mem_on_heap() && 
      resources.get_mem_on_heap() > 0) {
    memOnheap = (int) Math.ceil(resources.get_mem_on_heap());
  } else {
    // set the default heap memory size for supervisor-test
    memOnheap = Utils.getInt(_topoConf.get(Config.WORKER_HEAP_MEMORY_MB), 768);
  }
  return memOnheap;
}

代码示例来源:origin: ptgoetz/storm-signals

@SuppressWarnings("rawtypes")
public void init(Map conf) throws Exception {
  String connectString = zkHosts(conf);
  int retryCount = Utils.getInt(conf.get("storm.zookeeper.retry.times"));
  int retryInterval = Utils.getInt(conf.get("storm.zookeeper.retry.interval"));
  this.client = CuratorFrameworkFactory.builder().namespace(namespace).connectString(connectString)
      .retryPolicy(new RetryNTimes(retryCount, retryInterval)).build();
  this.client.start();
  super.initWatcher();
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
  _rand = new Random(Utils.secureRandomLong());
  _state = TransactionalState.newCoordinatorState(conf, (String) conf.get(Config.TOPOLOGY_TRANSACTIONAL_ID), _spout.getComponentConfiguration());
  _coordinatorState = new RotatingTransactionalState(_state, META_DIR, true);
  _collector = collector;
  _coordinator = _spout.getCoordinator(conf, context);
  _currTransaction = getStoredCurrTransaction(_state);
  _maxTransactionActive = Utils.getInt(conf.get(Config.TOPOLOGY_MAX_SPOUT_PENDING), 1);
  _initializer = new StateInitializer();
}

相关文章

Utils类方法