RunUtil
public class RunUtil
extends Object
implements IRunUtil
java.lang.Object | |
↳ | com.android.tradefed.util.RunUtil |
작업 실행을 위한 도우미 메서드 모음입니다.
요약
필드 | |
---|---|
public static final String | INHERITIO_PREFIX |
public static final String | RUNNABLE_NOTIFIER_NAME
|
공개 생성자 | |
---|---|
RunUtil () 사용할 새 |
공개 메소드 | |
---|---|
void | allowInterrupt (boolean allow) 현재 스레드에서 실행 인터럽트를 허용/허용하지 않습니다. |
static IRunUtil | getDefault () 기본 |
void | interrupt (Thread thread, String message, ErrorIdentifier errorId) 지정된 스레드에서 진행 중이거나 향후 실행 작업을 중단합니다. |
void | interrupt (Thread thread, String message) 지정된 스레드에서 진행 중이거나 향후 실행 작업을 중단합니다. |
boolean | isInterruptAllowed () RunUtil의 인터럽트 상태를 제공합니다. |
Process | runCmdInBackground (Redirect redirect, command) runCmdInBackground (Redirect redirect, command) |
Process | runCmdInBackground ( command) runCmdInBackground ( command) |
Process | runCmdInBackground ( command, OutputStream output) runCmdInBackground ( command, OutputStream output) |
Process | runCmdInBackground (String... command) 시스템 명령을 비동기적으로 실행하는 도우미 메서드입니다. |
Process | runCmdInBackground (Redirect redirect, String... command) 시스템 명령을 비동기적으로 실행하는 도우미 메서드입니다. |
boolean | runEscalatingTimedRetry (long opTimeout, long initialPollInterval, long maxPollInterval, long maxTime, IRunUtil.IRunnableResult runnable) 성공할 때까지 작업을 여러 번 차단하고 실행합니다. |
boolean | runFixedTimedRetry (long opTimeout, long pollInterval, long maxTime, IRunUtil.IRunnableResult runnable) 성공할 때까지 작업을 여러 번 차단하고 실행합니다. |
boolean | runFixedTimedRetryWithOutputMonitor (long opTimeout, long idleOutputTimeout, long pollInterval, long maxTime, IRunUtil.IRunnableResult runnable) 성공할 때까지 작업을 여러 번 차단하고 실행합니다. |
CommandStatus | runTimed (long timeout, IRunUtil.IRunnableResult runnable, boolean logErrors) 작업을 차단하고 실행하며, 지정된 시간보다 오래 걸리면 중단합니다. |
CommandResult | runTimedCmd (long timeout, OutputStream stdout, OutputStream stderr, String... command) 시스템 명령을 실행하고, 지정된 시간보다 오래 걸리면 중단하고, 지정된 경우 출력을 파일로 리디렉션하는 도우미 메서드입니다. |
CommandResult | runTimedCmd (long timeout, String... command) 시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. |
CommandResult | runTimedCmdRetry (long timeout, long retryInterval, int attempts, String... command) 시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. |
CommandResult | runTimedCmdRetryWithOutputMonitor (long timeout, long idleOutputTimeout, long retryInterval, int attempts, String... command) 시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. |
CommandResult | runTimedCmdSilently (long timeout, String... command) 시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. |
CommandResult | runTimedCmdSilentlyRetry (long timeout, long retryInterval, int attempts, String... command) 시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. |
CommandResult | runTimedCmdWithInput (long timeout, String input, File stdoutFile, File stderrFile, String... command) 시스템 명령을 실행하고, 지정된 시간보다 오래 걸리면 중단하고, 지정된 경우 출력을 파일로 리디렉션하는 도우미 메서드입니다. |
CommandResult | runTimedCmdWithInput (long timeout, String input, String... command) stdin 입력이 필요한 시스템 명령을 실행하고, 지정된 시간보다 오래 걸릴 경우 중단하는 도우미 메서드입니다. |
CommandResult | runTimedCmdWithInput (long timeout, String input, command) runTimedCmdWithInput (long timeout, String input, command) stdin 입력이 필요한 시스템 명령을 실행하고, 지정된 시간보다 오래 걸릴 경우 중단하는 도우미 메서드입니다. |
CommandResult | runTimedCmdWithInputRedirect (long timeout, File inputRedirect, String... command) 파일에서 Stdin을 리디렉션하고 지정된 시간보다 오래 걸리는 경우 중단해야 하는 시스템 명령을 실행하는 도우미 메서드입니다. |
CommandResult | runTimedCmdWithOutputMonitor (long timeout, long idleOutputTimeout, OutputStream stdout, OutputStream stderr, String... command) 시스템 명령을 실행하고, 지정된 시간보다 오래 걸리면 중단하고, 지정된 경우 출력을 파일로 리디렉션하는 도우미 메서드입니다. |
CommandResult | runTimedCmdWithOutputMonitor (long timeout, long idleOutputTimeout, String... command) 시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. |
boolean | runTimedRetry (long opTimeout, long pollInterval, int attempts, IRunUtil.IRunnableResult runnable) 성공할 때까지 작업을 여러 번 차단하고 실행합니다. |
boolean | runTimedRetryWithOutputMonitor (long opTimeout, long idleOutputTimeout, long pollInterval, int attempts, IRunUtil.IRunnableResult runnable) 성공할 때까지 작업을 여러 번 차단하고 실행합니다. |
CommandStatus | runTimedWithOutputMonitor (long timeout, long idleOutputTimeout, IRunUtil.IRunnableResult runnable, boolean logErrors) 작업을 차단하고 실행하며, 지정된 시간보다 오래 걸리면 중단합니다. |
void | setEnvVariable (String name, String value) 시스템 명령을 실행할 때 사용할 환경 변수를 설정합니다. |
void | setEnvVariablePriority ( IRunUtil.EnvPriority priority) 프로세스를 생성할 때 환경 변수를 설정하는 것보다 설정하지 않는 것이 우선순위인지 여부를 결정합니다. |
void | setInterruptibleInFuture (Thread thread, long timeMs) 약간의 대기 시간이 지나면 중단 가능으로 설정됩니다. |
void | setLinuxInterruptProcess (boolean interrupt) 시간 초과에 도달하면 #runTimed 메서드를 통해 실행 중인 프로세스에서 Linux 'kill' 중단을 사용할 수 있습니다. |
void | setRedirectStderrToStdout (boolean redirect) 시스템 명령을 실행할 때 표준 출력 스트림으로 리디렉션되도록 표준 오류 스트림을 설정합니다. |
void | setWorkingDir (File dir) 시스템 명령에 대한 작업 디렉터리를 설정합니다. |
void | sleep (long time) 예외를 무시하고 지정된 시간 동안 잠을 자는 도우미 메서드입니다. |
void | unsetEnvVariable (String key) 환경 변수를 설정 해제하여 시스템 명령이 이 환경 변수 없이 실행되도록 합니다. 환경 변수는 상위 프로세스에서 상속될 수 있으므로 |
필드
INHERITIO_PREFIX
public static final String INHERITIO_PREFIX
RUNNABLE_NOTIFIER_NAME
public static final String RUNNABLE_NOTIFIER_NAME
공개 생성자
공개 메소드
인터럽트 허용
public void allowInterrupt (boolean allow)
현재 스레드에서 실행 인터럽트를 허용/허용하지 않습니다. 허용되는 경우 현재 스레드의 실행 작업은 interrupt(Thread, String)
메서드를 통해 다른 스레드에서 중단될 수 있습니다.
매개변수 | |
---|---|
allow | boolean : 현재 스레드에서 실행 인터럽트를 허용할지 여부입니다. |
getDefault
public static IRunUtil getDefault ()
기본 RunUtil
개체에 대한 참조를 가져옵니다.
setEnvVariable(String, String)
또는 setWorkingDir(File)
호출해야 함) 자체 복사본을 만드는 것이 좋습니다.보고 | |
---|---|
IRunUtil |
방해하다
public void interrupt (Thread thread, String message, ErrorIdentifier errorId)
지정된 스레드에서 진행 중이거나 향후 실행 작업을 중단합니다. 지정된 스레드의 실행 작업은 RunInterruptedException
발생시킵니다.
매개변수 | |
---|---|
message | String : RunInterruptedException 에 대한 메시지입니다. |
errorId | ErrorIdentifier : 알려진 경우 중단 원인을 나타냅니다. |
방해하다
public void interrupt (Thread thread, String message)
지정된 스레드에서 진행 중이거나 향후 실행 작업을 중단합니다. 지정된 스레드의 실행 작업은 RunInterruptedException
발생시킵니다.
매개변수 | |
---|---|
message | String : RunInterruptedException 에 대한 메시지입니다. |
인터럽트가 허용됨
public boolean isInterruptAllowed ()
RunUtil의 인터럽트 상태를 제공합니다.
보고 | |
---|---|
boolean | 실행을 중단할 수 있으면 true이고, 그렇지 않으면 false입니다. |
runCmdIn백그라운드
public Process runCmdInBackground (Redirect redirect,command)
ERROR(/List)
형식의 명령 인수를 허용하는 대체 runCmdInBackground(String)
메서드입니다.
매개변수 | |
---|---|
redirect | Redirect : ProcessBuilder 에 적용할 ERROR(/Redirect) . |
command | ERROR(/List) |
보고 | |
---|---|
Process | 실행된 명령의 Process |
runCmdIn백그라운드
public Process runCmdInBackground (command)
ERROR(/List)
형식의 명령 인수를 허용하는 대체 runCmdInBackground(String)
메서드입니다.
매개변수 | |
---|---|
command | ERROR(/List) |
보고 | |
---|---|
Process | 실행된 명령의 Process |
runCmdIn백그라운드
public Process runCmdInBackground (command, OutputStream output)
ERROR(/OutputStream)
사용하여 명령을 실행하면 명령의 출력이 기록됩니다. Stdout과 stderr은 함께 병합됩니다.
매개변수 | |
---|---|
command | |
output | OutputStream : 출력을 저장할 OutputStream |
보고 | |
---|---|
Process | 명령을 실행하는 Process |
runCmdIn백그라운드
public Process runCmdInBackground (String... command)
시스템 명령을 비동기적으로 실행하는 도우미 메서드입니다.
명령을 실행한 후 즉시 반환됩니다.
매개변수 | |
---|---|
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
Process | 실행된 명령의 Process |
runCmdIn백그라운드
public Process runCmdInBackground (Redirect redirect, String... command)
시스템 명령을 비동기적으로 실행하는 도우미 메서드입니다.
명령을 실행한 후 즉시 반환됩니다.
매개변수 | |
---|---|
redirect | Redirect : ProcessBuilder 에 적용할 ERROR(/Redirect) . |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
Process | 실행된 명령의 Process |
runEscalatingTimed재시도
public boolean runEscalatingTimedRetry (long opTimeout, long initialPollInterval, long maxPollInterval, long maxTime, IRunUtil.IRunnableResult runnable)
성공할 때까지 작업을 여러 번 차단하고 실행합니다.
작업 시도 사이의 대기 시간을 기하급수적으로 늘립니다. 이는 서버 폴링과 같은 작업을 수행할 때 일시적으로 다운되는 경우 복구할 시간을 주기 위해 사용하기 위한 것입니다.매개변수 | |
---|---|
opTimeout | long : 단일 작업 시도를 기다리는 최대 시간(ms) |
initialPollInterval | long : 작업 시도 사이에 대기하는 초기 시간 |
maxPollInterval | long : 작업 시도 사이에 대기하는 최대 시간 |
maxTime | long : 작업을 계속 시도하는 데 소요되는 대략적인 최대 총 시간 |
runnable | IRunUtil.IRunnableResult : 실행할 IRunUtil.IRunnableResult |
보고 | |
---|---|
boolean | maxTime이 만료되기 전에 작업이 성공적으로 완료되면 true 입니다. |
runFixedTimed재시도
public boolean runFixedTimedRetry (long opTimeout, long pollInterval, long maxTime, IRunUtil.IRunnableResult runnable)
성공할 때까지 작업을 여러 번 차단하고 실행합니다.
매개변수 | |
---|---|
opTimeout | long : 단일 작업 시도를 기다리는 최대 시간(ms) |
pollInterval | long : 작업 시도 사이에 대기하는 초기 시간 |
maxTime | long : 작업을 계속 시도하는 데 소요되는 대략적인 최대 총 시간 |
runnable | IRunUtil.IRunnableResult : 실행할 IRunUtil.IRunnableResult |
보고 | |
---|---|
boolean | maxTime이 만료되기 전에 작업이 성공적으로 완료되면 true 입니다. |
runFixedTimedRetryWithOutputMonitor
public boolean runFixedTimedRetryWithOutputMonitor (long opTimeout, long idleOutputTimeout, long pollInterval, long maxTime, IRunUtil.IRunnableResult runnable)
성공할 때까지 작업을 여러 번 차단하고 실행합니다. 또한 출력 스트림의 활동을 모니터링하여 지정된 시간 동안 스트림 활동이 관찰되지 않으면 중단합니다. dleOutputTimeout이 0으로 설정되면 스트림 모니터링이 발생하지 않습니다.
매개변수 | |
---|---|
opTimeout | long : 단일 작업 시도를 기다리는 최대 시간(ms) |
idleOutputTimeout | long : 출력 스트림에서 출력을 기다리는 최대 시간(ms) |
pollInterval | long : 작업 시도 사이에 대기하는 초기 시간 |
maxTime | long : 작업을 계속 시도하는 데 소요되는 대략적인 최대 총 시간 |
runnable | IRunUtil.IRunnableResult : 실행할 IRunUtil.IRunnableResult |
보고 | |
---|---|
boolean | maxTime이 만료되기 전에 작업이 성공적으로 완료되면 true 입니다. |
실행 시간이 지정됨
public CommandStatus runTimed (long timeout, IRunUtil.IRunnableResult runnable, boolean logErrors)
작업을 차단하고 실행하며, 지정된 시간보다 오래 걸리면 중단합니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms) |
runnable | IRunUtil.IRunnableResult : 실행할 IRunUtil.IRunnableResult |
logErrors | boolean : 예외 발생 시 오류를 기록할지 여부. |
보고 | |
---|---|
CommandStatus | CommandStatus 작업 결과. |
runTimedCmd
public CommandResult runTimedCmd (long timeout, OutputStream stdout, OutputStream stderr, String... command)
시스템 명령을 실행하고, 지정된 시간보다 오래 걸리면 중단하고, 지정된 경우 출력을 파일로 리디렉션하는 도우미 메서드입니다. ERROR(/OutputStream)
이런 방식으로 제공되면 함수가 끝날 때 열린 상태로 유지됩니다.
매개변수 | |
---|---|
timeout | long : timeout 대기할 최대 시간(ms)입니다. 0은 시간 초과가 없음을 의미합니다. |
stdout | OutputStream : 표준 출력이 리디렉션되는 ERROR(/OutputStream) 입니다. null일 수 있습니다. |
stderr | OutputStream : 오류 출력이 리디렉션되는 ERROR(/OutputStream) 입니다. null일 수 있습니다. |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmd
public CommandResult runTimedCmd (long timeout, String... command)
시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 메서드입니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms)입니다. 0은 시간 초과가 없음을 의미합니다. |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmd재시도
public CommandResult runTimedCmdRetry (long timeout, long retryInterval, int attempts, String... command)
시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다.
매개변수 | |
---|---|
timeout | long : 각 시도에 대해 대기하는 최대 시간(ms) |
retryInterval | long : 명령 재시도 사이에 대기하는 시간 |
attempts | int : 최대 시도 횟수 |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmdRetryWithOutputMonitor
public CommandResult runTimedCmdRetryWithOutputMonitor (long timeout, long idleOutputTimeout, long retryInterval, int attempts, String... command)
시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. 또한 출력 스트림의 활동을 모니터링하여 지정된 시간 동안 스트림 활동이 관찰되지 않으면 중단됩니다. dleOutputTimeout이 0으로 설정되면 스트림 모니터링이 발생하지 않습니다.
매개변수 | |
---|---|
timeout | long : 각 시도에 대해 대기하는 최대 시간(ms) |
idleOutputTimeout | long : 출력 스트림에서 출력을 기다리는 최대 시간(ms) |
retryInterval | long : 명령 재시도 사이에 대기하는 시간 |
attempts | int : 최대 시도 횟수 |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmd자동으로
public CommandResult runTimedCmdSilently (long timeout, String... command)
시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 메서드입니다. runTimedCmd(long, String)
과 유사하지만 예외 시 오류를 기록하지 않습니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms) |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmd자동으로재시도
public CommandResult runTimedCmdSilentlyRetry (long timeout, long retryInterval, int attempts, String... command)
시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. runTimedCmdRetry(long, long, int, String[])
와 유사하지만 예외 시 오류를 기록하지 않습니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms) |
retryInterval | long : 명령 재시도 사이에 대기하는 시간 |
attempts | int : 최대 시도 횟수 |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmdWithInput
public CommandResult runTimedCmdWithInput (long timeout, String input, File stdoutFile, File stderrFile, String... command)
시스템 명령을 실행하고, 지정된 시간보다 오래 걸리면 중단하고, 지정된 경우 출력을 파일로 리디렉션하는 도우미 메서드입니다.
매개변수 | |
---|---|
timeout | long : timeout 대기할 최대 시간(ms)입니다. 0은 시간 초과가 없음을 의미합니다. |
input | String : 프로세스에 전달할 stdin 입력 |
stdoutFile | File : 표준 출력이 리디렉션되는 ERROR(/File) 입니다. null일 수 있습니다. |
stderrFile | File : 오류 출력이 리디렉션되는 ERROR(/File) 입니다. null일 수 있습니다. |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmdWithInput
public CommandResult runTimedCmdWithInput (long timeout, String input, String... command)
stdin 입력이 필요한 시스템 명령을 실행하고, 지정된 시간보다 오래 걸릴 경우 중단하는 도우미 메서드입니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms) |
input | String : 프로세스에 전달할 stdin 입력 |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmdWithInput
public CommandResult runTimedCmdWithInput (long timeout, String input,command)
stdin 입력이 필요한 시스템 명령을 실행하고, 지정된 시간보다 오래 걸릴 경우 중단하는 도우미 메서드입니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms) |
input | String : 프로세스에 전달할 stdin 입력 |
command | ERROR(/List) |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmdWithInputRedirect
public CommandResult runTimedCmdWithInputRedirect (long timeout, File inputRedirect, String... command)
파일에서 Stdin을 리디렉션하고 지정된 시간보다 오래 걸리는 경우 중단해야 하는 시스템 명령을 실행하는 도우미 메서드입니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms) |
inputRedirect | File : ProcessBuilder.redirectInput() 사용하여 표준 입력으로 리디렉션할 ERROR(/File) . null인 경우 stdin은 리디렉션되지 않습니다. |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmdWithOutputMonitor
public CommandResult runTimedCmdWithOutputMonitor (long timeout, long idleOutputTimeout, OutputStream stdout, OutputStream stderr, String... command)
시스템 명령을 실행하고, 지정된 시간보다 오래 걸리면 중단하고, 지정된 경우 출력을 파일로 리디렉션하는 도우미 메서드입니다. ERROR(/OutputStream)
이런 방식으로 제공되면 함수가 끝날 때 열린 상태로 유지됩니다.
매개변수 | |
---|---|
timeout | long : timeout 대기할 최대 시간(ms)입니다. 0은 시간 초과가 없음을 의미합니다. |
idleOutputTimeout | long : 출력 스트림에서 출력을 기다리는 최대 시간(ms) |
stdout | OutputStream : 표준 출력이 리디렉션되는 ERROR(/OutputStream) 입니다. null일 수 있습니다. |
stderr | OutputStream : 오류 출력이 리디렉션되는 ERROR(/OutputStream) 입니다. null일 수 있습니다. |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimedCmdWithOutputMonitor
public CommandResult runTimedCmdWithOutputMonitor (long timeout, long idleOutputTimeout, String... command)
시스템 명령을 실행하고 지정된 시간보다 오래 걸리면 중단하는 도우미 방법입니다. 또한 출력 스트림의 활동을 모니터링하여 지정된 시간 동안 스트림 활동이 관찰되지 않으면 중단됩니다. dleOutputTimeout이 0으로 설정되면 스트림 모니터링이 발생하지 않습니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms)입니다. 0은 시간 초과가 없음을 의미합니다. |
idleOutputTimeout | long : 출력 스트림에서 출력을 기다리는 최대 시간(ms) |
command | String : 지정된 시스템 명령 및 선택적으로 exec에 대한 인수 |
보고 | |
---|---|
CommandResult | 명령 실행 결과를 포함하는 CommandResult |
runTimed재시도
public boolean runTimedRetry (long opTimeout, long pollInterval, int attempts, IRunUtil.IRunnableResult runnable)
성공할 때까지 작업을 여러 번 차단하고 실행합니다.
매개변수 | |
---|---|
opTimeout | long : 한 번의 작업 시도를 기다리는 최대 시간(ms) |
pollInterval | long : 명령 재시도 사이에 대기하는 시간 |
attempts | int : 최대 시도 횟수 |
runnable | IRunUtil.IRunnableResult : 실행할 IRunUtil.IRunnableResult |
보고 | |
---|---|
boolean | 시도에 도달하기 전에 작업이 성공적으로 완료되면 true 입니다. |
runTimedRetryWithOutputMonitor
public boolean runTimedRetryWithOutputMonitor (long opTimeout, long idleOutputTimeout, long pollInterval, int attempts, IRunUtil.IRunnableResult runnable)
성공할 때까지 작업을 여러 번 차단하고 실행합니다. 또한 출력 스트림의 활동을 모니터링하여 지정된 시간 동안 스트림 활동이 관찰되지 않으면 중단합니다. dleOutputTimeout이 0으로 설정되면 스트림 모니터링이 발생하지 않습니다.
매개변수 | |
---|---|
opTimeout | long : 한 번의 작업 시도를 기다리는 최대 시간(ms) |
idleOutputTimeout | long : 출력 스트림에서 출력을 기다리는 최대 시간(ms) |
pollInterval | long : 명령 재시도 사이에 대기하는 시간 |
attempts | int : 최대 시도 횟수 |
runnable | IRunUtil.IRunnableResult : 실행할 IRunUtil.IRunnableResult |
보고 | |
---|---|
boolean | 시도에 도달하기 전에 작업이 성공적으로 완료되면 true 입니다. |
runTimedWithOutputMonitor
public CommandStatus runTimedWithOutputMonitor (long timeout, long idleOutputTimeout, IRunUtil.IRunnableResult runnable, boolean logErrors)
작업을 차단하고 실행하며, 지정된 시간보다 오래 걸리면 중단합니다. 또한 출력 스트림의 활동을 모니터링하여 지정된 시간 동안 스트림 활동이 관찰되지 않으면 중단됩니다. dleOutputTimeout이 0으로 설정되면 스트림 모니터링이 발생하지 않습니다.
매개변수 | |
---|---|
timeout | long : 최대 대기 시간(ms) |
idleOutputTimeout | long : 출력 스트림에서 출력을 기다리는 최대 시간(ms) |
runnable | IRunUtil.IRunnableResult : 실행할 IRunUtil.IRunnableResult |
logErrors | boolean : 예외 발생 시 오류를 기록할지 여부. |
보고 | |
---|---|
CommandStatus | CommandStatus 작업 결과. |
setEnv변수
public void setEnvVariable (String name, String value)
시스템 명령을 실행할 때 사용할 환경 변수를 설정합니다.
매개변수 | |
---|---|
name | String : 변수 이름 |
value | String : 변수 값 |
setEnvVariablePriority
public void setEnvVariablePriority (IRunUtil.EnvPriority priority)
프로세스를 생성할 때 환경 변수를 설정하는 것보다 설정하지 않는 것이 우선순위인지 여부를 결정합니다. 기본적으로 설정 해제가 우선순위가 더 높습니다. 즉, 동일한 이름의 변수를 설정하려고 하면 변수가 설정 해제되므로 해당 작업이 발생하지 않습니다. 기본 IRunUtil
인스턴스에서는 사용할 수 없습니다.
매개변수 | |
---|---|
priority | IRunUtil.EnvPriority |
setInterruptibleInFuture
public void setInterruptibleInFuture (Thread thread, long timeMs)
약간의 대기 시간이 지나면 중단 가능으로 설정됩니다. ERROR(/CommandScheduler#shutdownHard())
적용하여 결국 종료합니다.
매개변수 | |
---|---|
thread | Thread : 인터럽트 가능한 스레드입니다. |
timeMs | long : 인터럽트 가능을 설정하기 전에 기다리는 시간입니다. |
setLinux인터럽트프로세스
public void setLinuxInterruptProcess (boolean interrupt)
시간 초과에 도달하면 #runTimed 메서드를 통해 실행 중인 프로세스에서 Linux 'kill' 중단을 사용할 수 있습니다. 기본 IRunUtil
인스턴스에서는 사용할 수 없습니다.
매개변수 | |
---|---|
interrupt | boolean |
setRedirectStderrToStdout
public void setRedirectStderrToStdout (boolean redirect)
시스템 명령을 실행할 때 표준 출력 스트림으로 리디렉션되도록 표준 오류 스트림을 설정합니다. 초기값은 거짓입니다.
매개변수 | |
---|---|
redirect | boolean : 리디렉션 여부에 대한 새 값 |
setWorkingDir
public void setWorkingDir (File dir)
시스템 명령에 대한 작업 디렉터리를 설정합니다.
매개변수 | |
---|---|
dir | File : 작업 디렉토리 |
잠
public void sleep (long time)
예외를 무시하고 지정된 시간 동안 잠을 자는 도우미 메서드입니다.
매개변수 | |
---|---|
time | long : ms 잠자기. 0보다 작거나 같은 값은 무시됩니다. |
unsetEnv변수
public void unsetEnvVariable (String key)
환경 변수를 설정 해제하여 시스템 명령이 이 환경 변수 없이 실행되도록 합니다. 환경 변수는 상위 프로세스에서 상속될 수 있으므로 ProcessBuilder.environment()
에서 환경 변수를 삭제해야 합니다.
매개변수 | |
---|---|
key | String : 변수 이름 |
또한보십시오: