我在java.Multiple进程中使用ProcessBuilder启动了一个进程.如果我想停止一个进程.如何停止进程.
public void terminalExecute(String builder) throws InterruptedException
{
System.out.println(builder);
String[] splits = builder.split(" ");
System.out.println(splits.length);
ProcessBuilder pb = new ProcessBuilder(splits[0],splits[1],splits[2],splits[3],splits[4],splits[5],splits[6],splits[7]);
Process p = null ;
pb.redirectErrorStream(true);
try {
p = pb.start();
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
String s = "";
while((s = in.readLine()) != null){
System.out.println(s);
}
int status = p.waitFor();
System.out.println("Exited with status: " + status);
} catch (IOException e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
在另一类称为我喜欢这个函数:字符串CMD = "java的-Xmx3024m -XX:MaxPermSize参数=512米-Xms1024m -cp "+ ConfReader.getABDFJarPath()+" edu.am.abdf.core.StrWorkflow" +新的BigInteger(serviceRequest .getBytes()); ProcessExecutor procExec = new …
Array为了从我尝试过的每一列中找到不同的值
RDD[Array[String]].map(_.map(Set(_))).reduce {
(a, b) => (a.zip(b)).map { case (x, y) => x ++ y}}
Run Code Online (Sandbox Code Playgroud)
执行成功。但是,我想知道是否有比上面的示例代码更有效的方法。谢谢。
我的阅读文本文件的示例代码是
val text = sc.hadoopFile(path, classOf[TextInputFormat], classOf[LongWritable], classOf[Text], sc.defaultMinPartitions)
var rddwithPath = text.asInstanceOf[HadoopRDD[LongWritable, Text]].mapPartitionsWithInputSplit { (inputSplit, iterator) ?
val file = inputSplit.asInstanceOf[FileSplit]
iterator.map { tpl ? (file.getPath.toString, tpl._2.toString) }
}.reduceByKey((a,b) => a)
Run Code Online (Sandbox Code Playgroud)
这样我怎么能使用PDF和Xml文件