gpt4 book ai didi

java - DefaultExecutor 不等待结果(异步调用)

转载 作者:行者123 更新时间:2023-12-01 12:30:59 26 4
gpt4 key购买 nike

有没有办法告诉 Apache DefaultExecutor 不要等待结果并继续执行代码?目前,它等待被调用的程序或脚本终止。

最佳答案

DefaultExecutor 具有异步执行的方法。

without environment :

public void execute(CommandLine command, ExecuteResultHandler handler) 
throws ExecuteException, IOException

with environment argument

public void execute(CommandLine command, Map<String,String> environment, ExecuteResultHandler handler)
throws ExecuteException, IOException

如果您想忽略结果,可以传递 ExecuteResultHandler 的无操作实现。

关于java - DefaultExecutor 不等待结果(异步调用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25921378/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com