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; }
public Emitter(Map conf) { Object c = conf.get(Config.TOPOLOGY_MAX_SPOUT_PENDING); if(c==null) _maxSpoutPending = 1; else _maxSpoutPending = Utils.getInt(c); }
public Emitter(Map conf) { Object c = conf.get(Config.TOPOLOGY_MAX_SPOUT_PENDING); if(c==null) _maxSpoutPending = 1; else _maxSpoutPending = Utils.getInt(c); }
public Integer getSocketTimeOut(Map conf) { if (_socketTimeoutConf == null) { return null; } return Utils.getInt(conf.get(_socketTimeoutConf)); }
public int getPort(Map conf) { return Utils.getInt(conf.get(_portConf)); }
public static Integer getGangliaTMax(Map reporterConf) { return Utils.getInt(reporterConf.get(GANGLIA_TMAX), null); }
/** * @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)); }
public static long getReportPeriod(Map reporterConf) { return Utils.getInt(reporterConf.get(REPORT_PERIOD), 10).longValue(); }
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)))); }
public static int getInt(Map<String, Object> conf, String key, int defaultValue) { Object obj = Utils.get(conf, key, defaultValue); return Utils.getInt(obj); }
/** * 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; }
@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; }
/** * 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); }
@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); } }
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)); }
public static void main(String[] args) throws Exception{ Utils u = new Tutorial4(); u.getInt("2"); }
/** * 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); }
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; }
@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(); }
@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(); }