Java 使用ExecutorService.submit结果将被篡改
我过去常常在Java中执行powershell,但当我Java 使用ExecutorService.submit结果将被篡改,java,Java,我过去常常在Java中执行powershell,但当我executeCommand() 这是我的密码: PowerShellResponse response = powerShell.executeCommand(getAll); //Print results System.out.println("result :" + response.getCommandOutput()); 在executeCommand()中使用: Future<String> result = th
executeCommand()
这是我的密码:
PowerShellResponse response = powerShell.executeCommand(getAll);
//Print results
System.out.println("result :" + response.getCommandOutput());
在executeCommand()中使用:
Future<String> result = threadpool.submit(commandProcessor);
commandOutput = result.get();
Future result=threadpool.submit(commandProcessor);
commandOutput=result.get();
我不知道如何对结果进行编码。也许这会有帮助
Future<String> result = threadpool.submit(commandProcessor);
while (!result.isDone()) {}
String commandOutput = result.get();
Future result=threadpool.submit(commandProcessor);
而(!result.isDone()){}
String commandOutput=result.get();