本文整理了Java中backtype.storm.task.TopologyContext.getCodeDir()
方法的一些代码示例,展示了TopologyContext.getCodeDir()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TopologyContext.getCodeDir()
方法的具体详情如下:
包路径:backtype.storm.task.TopologyContext
类名称:TopologyContext
方法名:getCodeDir
[英]Gets the location of the external resources for this worker on the local filesystem. These external resources typically include bolts implemented in other languages, such as Ruby or Python.
[中]
代码示例来源:origin: alibaba/mdrill
private String initializeSubprocess(TopologyContext context) {
//can change this to launchSubprocess and have it return the pid (that the subprcess returns)
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new File(context.getCodeDir()));
try {
_subprocess = builder.start();
_processin = new DataOutputStream(_subprocess.getOutputStream());
_processout = new BufferedReader(new InputStreamReader(_subprocess.getInputStream()));
sendToSubprocess(context.getPIDDir());
//subprocesses must send their pid first thing
String subpid = _processout.readLine();
LOG.info("Launched subprocess with pid " + subpid);
return subpid;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: alibaba/jstorm
public Number launch(Map conf, TopologyContext context) {
ProcessBuilder builder = new ProcessBuilder(command);
if (!env.isEmpty()) {
Map<String, String> buildEnv = builder.environment();
modifyEnvironment(buildEnv);
}
builder.directory(new File(context.getCodeDir()));
ShellLogger = LoggerFactory.getLogger(context.getThisComponentId());
this.componentName = context.getThisComponentId();
this.serializer = getSerializer(conf);
try {
_subprocess = builder.start();
processErrorStream = _subprocess.getErrorStream();
serializer.initialize(_subprocess.getOutputStream(), _subprocess.getInputStream());
this.pid = serializer.connect(conf, context);
} catch (IOException e) {
throw new RuntimeException(
"Error when launching multilang subprocess\n"
+ getErrorsString(), e);
} catch (NoOutputException e) {
throw new RuntimeException(e + getErrorsString() + "\n");
}
return this.pid;
}
代码示例来源:origin: com.n3twork.storm/storm-core
public Number launch(Map conf, TopologyContext context) {
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new File(context.getCodeDir()));
ShellLogger = Logger.getLogger(context.getThisComponentId());
this.serializer = getSerializer(conf);
Number pid;
try {
_subprocess = builder.start();
processErrorStream = _subprocess.getErrorStream();
serializer.initialize(_subprocess.getOutputStream(), _subprocess.getInputStream());
pid = serializer.connect(conf, context);
} catch (IOException e) {
throw new RuntimeException(
"Error when launching multilang subprocess\n"
+ getErrorsString(), e);
} catch (NoOutputException e) {
throw new RuntimeException(e + getErrorsString() + "\n");
}
return pid;
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
public Number launch(Map conf, TopologyContext context) {
ProcessBuilder builder = new ProcessBuilder(command);
if (!env.isEmpty()) {
Map<String, String> buildEnv = builder.environment();
modifyEnvironment(buildEnv);
}
builder.directory(new File(context.getCodeDir()));
ShellLogger = LoggerFactory.getLogger(context.getThisComponentId());
this.componentName = context.getThisComponentId();
this.serializer = getSerializer(conf);
try {
_subprocess = builder.start();
processErrorStream = _subprocess.getErrorStream();
serializer.initialize(_subprocess.getOutputStream(), _subprocess.getInputStream());
this.pid = serializer.connect(conf, context);
} catch (IOException e) {
throw new RuntimeException(
"Error when launching multilang subprocess\n"
+ getErrorsString(), e);
} catch (NoOutputException e) {
throw new RuntimeException(e + getErrorsString() + "\n");
}
return this.pid;
}
内容来源于网络,如有侵权,请联系作者删除!