当前位置: 首页>>代码示例>>Java>>正文


Java ShellProcess.getErrorsString方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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


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