• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ShellProcess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中backtype.storm.utils.ShellProcess的典型用法代码示例。如果您正苦于以下问题:Java ShellProcess类的具体用法?Java ShellProcess怎么用?Java ShellProcess使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ShellProcess类属于backtype.storm.utils包,在下文中一共展示了ShellProcess类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: open

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
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));
   }
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:17,代码来源:ShellSpout.java


示例2: prepare

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
@Override
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();
   }
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:34,代码来源:ShellBolt.java


示例3: prepare

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
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();
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:33,代码来源:ShellBolt.java


示例4: open

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
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));
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:15,代码来源:ShellSpout.java


示例5: prepare

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
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();
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:32,代码来源:ShellBolt.java


示例6: open

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
public void open(Map stormConf, TopologyContext context,
		SpoutOutputCollector collector) {
	_process = new ShellProcess(_command);
	_collector = collector;

	try {
		Number subpid = _process.launch(stormConf, context);
		LOG.info("Launched subprocess with pid " + subpid);
	} catch (IOException e) {
		throw new RuntimeException(
				"Error when launching multilang subprocess\n"
						+ _process.getErrorsString(), e);
	}
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:15,代码来源:ShellSpout.java


示例7: open

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
public void open(Map stormConf, TopologyContext context,
                 SpoutOutputCollector collector) {
    _process = new ShellProcess(_command);
    _collector = collector;

    try {
        Number subpid = _process.launch(stormConf, context);
        LOG.info("Launched subprocess with pid " + subpid);
    } catch (IOException e) {
        throw new RuntimeException("Error when launching multilang subprocess\n" + _process.getErrorsString(), e);
    }
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:13,代码来源:ShellSpout.java


示例8: prepare

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
public void prepare(Map stormConf, TopologyContext context,
		final OutputCollector collector) {
	_rand = new Random();
	_process = new ShellProcess(_command);
	_collector = collector;

	try {
		// subprocesses must send their pid first thing
		Number subpid = _process.launch(stormConf, context);
		LOG.info("Launched subprocess with pid " + subpid);
	} catch (IOException e) {
		throw new RuntimeException(
				"Error when launching multilang subprocess\n"
						+ _process.getErrorsString(), e);
	}

	// reader
	_readerThread = new Thread(new Runnable() {
		public void run() {
			while (_running) {
				try {
					Map action = _process.readMessage();
					if (action == null) {
						// ignore sync
					}

					String command = (String) action.get("command");
					if (command.equals("ack")) {
						handleAck(action);
					} else if (command.equals("fail")) {
						handleFail(action);
					} else if (command.equals("error")) {
						handleError(action);
					} else if (command.equals("log")) {
						String msg = (String) action.get("msg");
						LOG.info("Shell msg: " + msg);
					} else if (command.equals("emit")) {
						handleEmit(action);
					}
				} catch (InterruptedException e) {
				} catch (Throwable t) {
					die(t);
				}
			}
		}
	});

	_readerThread.start();

	_writerThread = new Thread(new Runnable() {
		public void run() {
			while (_running) {
				try {
					Object write = _pendingWrites.poll(1, SECONDS);
					if (write != null) {
						_process.writeMessage(write);
					}
					// drain the error stream to avoid dead lock because of
					// full error stream buffer
					_process.drainErrorStream();
				} catch (InterruptedException e) {
				} catch (Throwable t) {
					die(t);
				}
			}
		}
	});

	_writerThread.start();
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:71,代码来源:ShellBolt.java


示例9: prepare

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
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();
    _process = new ShellProcess(_command);
    _collector = collector;

    try {
        //subprocesses must send their pid first thing
        Number subpid = _process.launch(stormConf, context);
        LOG.info("Launched subprocess with pid " + subpid);
    } catch (IOException e) {
        throw new RuntimeException("Error when launching multilang subprocess\n" + _process.getErrorsString(), e);
    }

    // reader
    _readerThread = new Thread(new Runnable() {
        public void run() {
            while (_running) {
                try {
                    JSONObject action = _process.readMessage();
                    if (action == null) {
                        // ignore sync
                    }

                    String command = (String) action.get("command");
                    if(command.equals("ack")) {
                        handleAck(action);
                    } else if (command.equals("fail")) {
                        handleFail(action);
                    } else if (command.equals("error")) {
                        handleError(action);
                    } else if (command.equals("log")) {
                        String msg = (String) action.get("msg");
                        LOG.info("Shell msg: " + msg);
                    } else if (command.equals("emit")) {
                        handleEmit(action);
                    }
                } catch (InterruptedException e) {
                } catch (Throwable t) {
                    die(t);
                }
            }
        }
    });
    
    _readerThread.start();

    _writerThread = new Thread(new Runnable() {
        public void run() {
            while (_running) {
                try {
                    Object write = _pendingWrites.poll(1, SECONDS);
                    if (write != null) {
                        _process.writeMessage(write);
                    }
                    // drain the error stream to avoid dead lock because of full error stream buffer
                    _process.drainErrorStream();
                } catch (InterruptedException e) {
                } catch (Throwable t) {
                    die(t);
                }
            }
        }
    });
    
    _writerThread.start();
}
 
开发者ID:metamx,项目名称:incubator-storm,代码行数:72,代码来源:ShellBolt.java


示例10: open

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
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));
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:14,代码来源:ShellSpout.java


示例11: open

import backtype.storm.utils.ShellProcess; //导入依赖的package包/类
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));
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:14,代码来源:ShellSpout.java



注:本文中的backtype.storm.utils.ShellProcess类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StringLabelFactory类代码示例发布时间:2022-05-22
下一篇:
Java ListTemplatesAction类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap