public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { _collector = collector; _context = context; workerTimeoutMills = 1000 * RT.intCast(stormConf.get(Config.SUPERVISOR_WORKER_TIMEOUT_SECS)); _process = new ShellProcess(_command); Number subPid = _process.launch(stormConf, context); LOG.info("Launched subprocess with pid " + subPid); heartBeatExecutorService = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1)); }
public void prepare(Map stormConf, TopologyContext context, final OutputCollector collector) { Object maxPending = stormConf.get(Config.TOPOLOGY_SHELLBOLT_MAX_PENDING); if (maxPending != null) { this._pendingWrites = new LinkedBlockingQueue(((Number) maxPending).intValue()); } _rand = new Random(); _collector = collector; _context = context; workerTimeoutMills = 1000 * RT.intCast(stormConf.get(Config.SUPERVISOR_WORKER_TIMEOUT_SECS)); _process = new ShellProcess(_command); // subprocesses must send their pid first thing Number subpid = _process.launch(stormConf, context); LOG.info("Launched subprocess with pid " + subpid); // reader _readerThread = new Thread(new BoltReaderRunnable()); _readerThread.start(); _writerThread = new Thread(new BoltWriterRunnable()); _writerThread.start(); heartBeatExecutorService = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1)); heartBeatExecutorService.scheduleAtFixedRate(new BoltHeartbeatTimerTask(this), 1, 1, TimeUnit.SECONDS); LOG.info("Start checking heartbeat..."); setHeartbeat(); }
int bucketSize = RT.intCast(stormConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS));
static public int intCast(Object x){ if(x instanceof Integer) return ((Integer)x).intValue(); if(x instanceof Number) { long n = longCast(x); return intCast(n); } return ((Character) x).charValue(); }
public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { _collector = collector; _context = context; workerTimeoutMills = 1000 * RT.intCast(stormConf.get(Config.SUPERVISOR_WORKER_TIMEOUT_SECS)); _process = new ShellProcess(_command); Number subpid = _process.launch(stormConf, context); LOG.info("Launched subprocess with pid " + subpid); heartBeatExecutorService = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1)); }
public void open(Map stormConf, TopologyContext context, SpoutOutputCollector collector) { _collector = collector; _context = context; if (stormConf.containsKey(Config.TOPOLOGY_SUBPROCESS_TIMEOUT_SECS)) { workerTimeoutMills = 1000 * RT.intCast(stormConf.get(Config.TOPOLOGY_SUBPROCESS_TIMEOUT_SECS)); } else { workerTimeoutMills = 1000 * RT.intCast(stormConf.get(Config.SUPERVISOR_WORKER_TIMEOUT_SECS)); } _process = new ShellProcess(_command); if (!env.isEmpty()) { _process.setEnv(env); } Number subpid = _process.launch(stormConf, context, changeDirectory); LOG.info("Launched subprocess with pid " + subpid); _logHandler = ShellUtils.getLogHandler(stormConf); _logHandler.setUpContext(ShellSpout.class, _process, _context); heartBeatExecutorService = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1)); }
public void prepare(Map stormConf, TopologyContext context, final OutputCollector collector) { Object maxPending = stormConf.get(Config.TOPOLOGY_SHELLBOLT_MAX_PENDING); if (maxPending != null) { this._pendingWrites = new LinkedBlockingQueue(((Number) maxPending).intValue()); } _rand = new Random(); _collector = collector; _context = context; workerTimeoutMills = 1000 * RT.intCast(stormConf.get(Config.SUPERVISOR_WORKER_TIMEOUT_SECS)); _process = new ShellProcess(_command); // subprocesses must send their pid first thing Number subpid = _process.launch(stormConf, context); LOG.info("Launched subprocess with pid " + subpid); // reader _readerThread = new Thread(new BoltReaderRunnable()); _readerThread.start(); _writerThread = new Thread(new BoltWriterRunnable()); _writerThread.start(); heartBeatExecutorService = MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1)); heartBeatExecutorService.scheduleAtFixedRate(new BoltHeartbeatTimerTask(this), 1, 1, TimeUnit.SECONDS); LOG.info("Start checking heartbeat..."); setHeartbeat(); }
int bucketSize = RT.intCast(stormConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS));
int bucketSize = RT.intCast(stormConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS));
int bucketSize = RT.intCast(stormConf.get(Config.TOPOLOGY_BUILTIN_METRICS_BUCKET_SIZE_SECS));
static public Object seqToTypedArray(Class type, ISeq seq) { Object ret = Array.newInstance(type, length(seq)); if(type == Integer.TYPE){ for(int i = 0; seq != null; ++i, seq=seq.next()){ Array.set(ret, i, intCast(seq.first())); } } else if(type == Byte.TYPE) { for(int i = 0; seq != null; ++i, seq=seq.next()){ Array.set(ret, i, byteCast(seq.first())); } } else if(type == Float.TYPE) { for(int i = 0; seq != null; ++i, seq=seq.next()){ Array.set(ret, i, floatCast(seq.first())); } } else if(type == Short.TYPE) { for(int i = 0; seq != null; ++i, seq=seq.next()){ Array.set(ret, i, shortCast(seq.first())); } } else if(type == Character.TYPE) { for(int i = 0; seq != null; ++i, seq=seq.next()){ Array.set(ret, i, charCast(seq.first())); } } else { for(int i = 0; seq != null; ++i, seq=seq.next()){ Array.set(ret, i, seq.first()); } } return ret; }