Вопрос

I am using java to call arp -s command and waiting for the process to finish in order to complete function .

String command ="arp -s "+entryIpAddress+" ee-ee-ee-ee-ee-ee-ee";
 Process p=Runtime.getRuntime().exec(command);  
         p.waitFor();

but the calling of this process is taking more than the usual time so, is there a way to increase the performance of this method. i cannot remove the p.waitFor() my next function depend on the added entry.

Это было полезно?

Решение

Your code doesn't show any sign of effort towards allowing the process to complete ever. You are not consuming its output, so its output buffer will soon fill up, blocking further progress.

To make this task easier on yourself, please use the ProcessBuilder.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top