IRunUtil
public
interface
IRunUtil
| com.android.tradefed.util.IRunUtil |
時間指定オペレーションとシステム コマンドを実行するためのインターフェース。
概要
ネストされたクラス | |
|---|---|
interface |
IRunUtil.IRunnableResult
ブール値のステータスを返すオペレーションを非同期で実行するためのインターフェース。 |
パブリック メソッド | |
|---|---|
abstract
void
|
allowInterrupt(boolean allow)
現在のスレッドでの実行割り込みを許可または禁止します。 |
abstract
void
|
interrupt(Thread thread, String message, ErrorIdentifier errorId)
指定されたスレッドで進行中または予定されている実行オペレーションを中断します。 |
abstract
void
|
interrupt(Thread thread, String message)
指定されたスレッドで進行中または予定されている実行オペレーションを中断します。 |
abstract
boolean
|
isInterruptAllowed()
RunUtil の割り込みステータスを返します。 |
abstract
Process
|
runCmdInBackground(ProcessBuilder.Redirect redirect, List<String> command)
コマンド引数を |
abstract
Process
|
runCmdInBackground(ProcessBuilder.Redirect redirect, String... command)
システム コマンドを非同期で実行するヘルパー メソッド。 |
abstract
Process
|
runCmdInBackground(List<String> command)
コマンド引数を |
abstract
Process
|
runCmdInBackground(String... command)
システム コマンドを非同期で実行するヘルパー メソッド。 |
abstract
Process
|
runCmdInBackground(List<String> command, OutputStream output)
|
abstract
boolean
|
runEscalatingTimedRetry(long opTimeout, long initialPollInterval, long maxPollInterval, long maxTime, IRunUtil.IRunnableResult runnable)
オペレーションが成功するまで、オペレーションをブロックして複数回実行します。 |
abstract
boolean
|
runFixedTimedRetry(long opTimeout, long pollInterval, long maxTime, IRunUtil.IRunnableResult runnable)
オペレーションが成功するまで、オペレーションをブロックして複数回実行します。 |
abstract
boolean
|
runFixedTimedRetryWithOutputMonitor(long opTimeout, long idleOutputTimeout, long pollInterval, long maxTime, IRunUtil.IRunnableResult runnable)
オペレーションが成功するまで、オペレーションをブロックして複数回実行します。 |
abstract
CommandStatus
|
runTimed(long timeout, IRunUtil.IRunnableResult runnable, boolean logErrors)
オペレーションをブロックして実行し、指定された時間より長くかかった場合は中止します。 |
abstract
CommandResult
|
runTimedCmd(long timeout, String... command)
システム コマンドを実行し、指定した時間より長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmd(long timeout, OutputStream stdout, OutputStream stderr, String... command)
システム コマンドを実行するヘルパー メソッド。指定した時間より長くかかった場合は中止し、指定した場合は出力をファイルにリダイレクトします。 |
abstract
CommandResult
|
runTimedCmdRetry(long timeout, long retryInterval, int attempts, String... command)
システム コマンドを実行し、指定した時間より長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdRetryWithOutputMonitor(long timeout, long idleOutputTimeout, long retryInterval, int attempts, String... command)
システム コマンドを実行し、指定した時間より長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdSilently(long timeout, String... command)
システム コマンドを実行し、指定した時間より長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdSilentlyRetry(long timeout, long retryInterval, int attempts, String... command)
システム コマンドを実行し、指定した時間より長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithInput(long timeout, String input, String... command)
stdin 入力を必要とするシステム コマンドを実行し、指定された時間よりも長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithInput(long timeout, String input, List<String> command)
stdin 入力を必要とするシステム コマンドを実行し、指定された時間よりも長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithInput(long timeout, String input, File stdoutFile, File stderrFile, String... command)
システム コマンドを実行するヘルパー メソッド。指定した時間より長くかかった場合は中止し、指定した場合は出力をファイルにリダイレクトします。 |
abstract
CommandResult
|
runTimedCmdWithInputRedirect(long timeout, File inputRedirect, String... command)
ファイルから Stdin をリダイレクトする必要があるシステム コマンドを実行し、指定した時間よりも長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithOutputMonitor(long timeout, long idleOutputTimeout, String... command)
システム コマンドを実行し、指定した時間より長くかかった場合は中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithOutputMonitor(long timeout, long idleOutputTimeout, OutputStream stdout, OutputStream stderr, String... command)
システム コマンドを実行するヘルパー メソッド。指定した時間より長くかかった場合は中止し、指定した場合は出力をファイルにリダイレクトします。 |
abstract
boolean
|
runTimedRetry(long opTimeout, long pollInterval, int attempts, IRunUtil.IRunnableResult runnable)
オペレーションが成功するまで、オペレーションをブロックして複数回実行します。 |
abstract
boolean
|
runTimedRetryWithOutputMonitor(long opTimeout, long idleOutputTimeout, long pollInterval, int attempts, IRunUtil.IRunnableResult runnable)
オペレーションが成功するまで、オペレーションをブロックして複数回実行します。 |
abstract
CommandStatus
|
runTimedWithOutputMonitor(long timeout, long idleOutputTimeout, IRunUtil.IRunnableResult runnable, boolean logErrors)
オペレーションをブロックして実行し、指定された時間より長くかかった場合は中止します。 |
abstract
void
|
setEnvVariable(String key, String value)
システム コマンドの実行時に使用される環境変数を設定します。 |
abstract
void
|
setEnvVariablePriority(IRunUtil.EnvPriority priority)
プロセスを作成するときに、環境変数の設定よりも設定解除の優先度を高くするかどうかを決定します。 |
abstract
void
|
setInterruptibleInFuture(Thread thread, long timeMs)
一定の待機時間の後に割り込み可能として設定します。 |
abstract
void
|
setLinuxInterruptProcess(boolean interrupt)
タイムアウトに達したときに、#runTimed メソッドで実行中のプロセスで linux の「kill」割り込みを使用できるようにします。 |
abstract
void
|
setRedirectStderrToStdout(boolean redirect)
システム コマンドの実行時に標準エラー ストリームが標準出力ストリームにリダイレクトされるように設定します。 |
abstract
void
|
setWorkingDir(File dir)
システム コマンドの作業ディレクトリを設定します。 |
abstract
void
|
sleep(long time)
指定された時間スリープし、例外を無視するヘルパー メソッド。 |
abstract
void
|
unsetEnvVariable(String key)
環境変数の設定を解除し、システム コマンドがこの環境変数なしで実行されるようにします。 |
パブリック メソッド
allowInterrupt
public abstract void allowInterrupt (boolean allow)
現在のスレッドで実行割り込みを許可または禁止します。許可されている場合、現在のスレッドのオペレーションの実行は、interrupt(Thread, String) メソッドを介して他のスレッドから中断できます。
| パラメータ | |
|---|---|
allow |
boolean: 現在のスレッドで実行の中断を許可するかどうか。 |
割り込む
public abstract void interrupt (Thread thread,
String message,
ErrorIdentifier errorId)指定されたスレッドで進行中または予定されている実行オペレーションを中断します。指定されたスレッドで実行されるオペレーションは RunInterruptedException をスローします。
| パラメータ | |
|---|---|
message |
String: RunInterruptedException のメッセージ。 |
errorId |
ErrorIdentifier: 中断の原因がわかっている場合は、その原因を表します。 |
割り込む
public abstract void interrupt (Thread thread,
String message)指定されたスレッドで進行中または予定されている実行オペレーションを中断します。指定されたスレッドで実行されるオペレーションは RunInterruptedException をスローします。
| パラメータ | |
|---|---|
message |
String: RunInterruptedException のメッセージ。 |
isInterruptAllowed
public abstract boolean isInterruptAllowed ()
RunUtil の割り込みステータスを返します。
| 戻り値 | |
|---|---|
boolean |
Run を中断できる場合は true、それ以外の場合は false。 |
runCmdInBackground
public abstract Process runCmdInBackground (ProcessBuilder.Redirect redirect,
List<String> command)List 形式でコマンド引数を受け取る代替の runCmdInBackground(String...) メソッド。
| パラメータ | |
|---|---|
redirect |
ProcessBuilder.Redirect: ProcessBuilder に適用する Redirect。 |
command |
List: 指定されたシステム コマンドと、必要に応じて実行する引数を含む List |
| 戻り値 | |
|---|---|
Process |
実行されたコマンドの Process |
| 例外 | |
|---|---|
IOException |
コマンドの実行に失敗した場合 |
runCmdInBackground
public abstract Process runCmdInBackground (ProcessBuilder.Redirect redirect,
String... command)システム コマンドを非同期で実行するヘルパー メソッド。
コマンドの起動直後に返されます。
| パラメータ | |
|---|---|
redirect |
ProcessBuilder.Redirect: ProcessBuilder に適用する Redirect。 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
Process |
実行されたコマンドの Process |
| 例外 | |
|---|---|
IOException |
コマンドの実行に失敗した場合 |
runCmdInBackground
public abstract Process runCmdInBackground (List<String> command)
List 形式でコマンド引数を受け取る代替の runCmdInBackground(String...) メソッド。
| パラメータ | |
|---|---|
command |
List: 指定されたシステム コマンドと、必要に応じて実行する引数を含む List |
| 戻り値 | |
|---|---|
Process |
実行されたコマンドの Process |
| 例外 | |
|---|---|
IOException |
コマンドの実行に失敗した場合 |
runCmdInBackground
public abstract Process runCmdInBackground (String... command)
システム コマンドを非同期で実行するヘルパー メソッド。
コマンドの起動直後に返されます。
| パラメータ | |
|---|---|
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
Process |
実行されたコマンドの Process |
| 例外 | |
|---|---|
IOException |
コマンドの実行に失敗した場合 |
runCmdInBackground
public abstract Process runCmdInBackground (List<String> command,
OutputStream output)OutputStream を指定してコマンドを実行すると、コマンドの出力がログに記録されます。stdout と stderr が統合されます。
| パラメータ | |
|---|---|
command |
List: 実行するコマンド |
output |
OutputStream: 出力を保存する OutputStream |
| 戻り値 | |
|---|---|
Process |
コマンドを実行している Process |
| 例外 | |
|---|---|
|
java.io.IOException |
IOException |
|
runEscalatingTimedRetry
public abstract boolean runEscalatingTimedRetry (long opTimeout,
long initialPollInterval,
long maxPollInterval,
long maxTime,
IRunUtil.IRunnableResult runnable)オペレーションが成功するまで、オペレーションをブロックして複数回実行します。
オペレーションの試行間の待機時間を指数関数的に増やします。これは、サーバーのポーリングなどのオペレーションを実行するときに、サーバーが一時的にダウンした場合に復旧する時間を確保するために使用することを目的としています。
| パラメータ | |
|---|---|
opTimeout |
long: 単一のオペレーション試行で待機する最大時間(ミリ秒単位) |
initialPollInterval |
long: オペレーションの試行間の初期待機時間 |
maxPollInterval |
long: オペレーションの試行間に待機する最大時間 |
maxTime |
long: オペレーションの再試行を継続するおおよその最大合計時間 |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
| 戻り値 | |
|---|---|
boolean |
maxTime が切れる前にオペレーションが正常に完了した場合は true |
runFixedTimedRetry
public abstract boolean runFixedTimedRetry (long opTimeout,
long pollInterval,
long maxTime,
IRunUtil.IRunnableResult runnable)成功するまでオペレーションを複数回ブロックして実行します。
| パラメータ | |
|---|---|
opTimeout |
long: 単一のオペレーション試行で待機する最大時間(ミリ秒単位) |
pollInterval |
long: オペレーションの試行間の初期待機時間 |
maxTime |
long: オペレーションの再試行を継続するおおよその最大合計時間 |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
| 戻り値 | |
|---|---|
boolean |
maxTime が切れる前にオペレーションが正常に完了した場合は true |
runFixedTimedRetryWithOutputMonitor
public abstract boolean runFixedTimedRetryWithOutputMonitor (long opTimeout,
long idleOutputTimeout,
long pollInterval,
long maxTime,
IRunUtil.IRunnableResult runnable)オペレーションが成功するまで、オペレーションを複数回ブロックして実行します。また、出力ストリームのアクティビティもモニタリングし、指定した時間内にストリーム アクティビティが検出されない場合は中止します。idleOutputTimeout がゼロに設定されている場合、ストリーム モニタリングは行われません。
| パラメータ | |
|---|---|
opTimeout |
long: 単一のオペレーション試行で待機する最大時間(ミリ秒単位) |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
pollInterval |
long: オペレーションの試行間の初期待機時間 |
maxTime |
long: オペレーションの再試行を継続するおおよその最大合計時間 |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
| 戻り値 | |
|---|---|
boolean |
maxTime が切れる前にオペレーションが正常に完了した場合は true |
runTimed
public abstract CommandStatus runTimed (long timeout, IRunUtil.IRunnableResult runnable, boolean logErrors)
オペレーションをブロックして実行し、指定した時間より長くかかった場合は中止します。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
logErrors |
boolean: 例外でエラーをログに記録するかどうか。 |
| 戻り値 | |
|---|---|
CommandStatus |
オペレーションの CommandStatus 結果。 |
runTimedCmd
public abstract CommandResult runTimedCmd (long timeout, String... command)
システム コマンドを実行し、指定した時間より長くかかった場合は中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmd
public abstract CommandResult runTimedCmd (long timeout, OutputStream stdout, OutputStream stderr, String... command)
システム コマンドを実行するヘルパー メソッド。指定された時間より長くかかった場合は中止し、指定された場合は出力をファイルにリダイレクトします。このように OutputStream が指定されている場合、関数が終了しても開いたままになります。
| パラメータ | |
|---|---|
timeout |
long: タイムアウトの最大待機時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
stdout |
OutputStream: 標準出力がリダイレクトされる OutputStream。null の場合もあります。 |
stderr |
OutputStream: エラー出力がリダイレクトされる OutputStream。null の場合もあります。 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdRetry
public abstract CommandResult runTimedCmdRetry (long timeout, long retryInterval, int attempts, String... command)
システム コマンドを実行し、指定した時間より長くかかった場合は中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 各試行の最大待機時間(ミリ秒) |
retryInterval |
long: コマンドの再試行の間に待機する時間 |
attempts |
int: 試行する最大回数 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdRetryWithOutputMonitor
public abstract CommandResult runTimedCmdRetryWithOutputMonitor (long timeout, long idleOutputTimeout, long retryInterval, int attempts, String... command)
システム コマンドを実行し、指定した時間を超えた場合は中止するヘルパー メソッド。また、出力ストリームのアクティビティもモニタリングし、指定した時間内にストリーム アクティビティが検出されない場合は中止します。idleOutputTimeout がゼロに設定されている場合、ストリーム モニタリングは行われません。
| パラメータ | |
|---|---|
timeout |
long: 各試行の最大待機時間(ミリ秒) |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
retryInterval |
long: コマンドの再試行の間に待機する時間 |
attempts |
int: 試行する最大回数 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdSilently
public abstract CommandResult runTimedCmdSilently (long timeout, String... command)
システム コマンドを実行し、指定した時間を超えた場合は中止するヘルパー メソッド。runTimedCmd(long,String...) に似ていますが、例外でエラーをログに記録しません。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdSilentlyRetry
public abstract CommandResult runTimedCmdSilentlyRetry (long timeout, long retryInterval, int attempts, String... command)
システム コマンドを実行し、指定した時間を超えた場合は中止するヘルパー メソッド。runTimedCmdRetry(long,long,int,String[]) に似ていますが、例外でエラーをログに記録しません。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
retryInterval |
long: コマンドの再試行の間に待機する時間 |
attempts |
int: 試行する最大回数 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdWithInput
public abstract CommandResult runTimedCmdWithInput (long timeout, String input, String... command)
stdin 入力を必要とするシステム コマンドを実行し、指定された時間よりも長くかかった場合は中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
input |
String: プロセスに渡す stdin 入力 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdWithInput
public abstract CommandResult runTimedCmdWithInput (long timeout, String input, List<String> command)
stdin 入力を必要とするシステム コマンドを実行し、指定された時間よりも長くかかった場合は中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
input |
String: プロセスに渡す stdin 入力 |
command |
List: システム コマンドと、必要に応じて実行する引数を含む List |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdWithInput
public abstract CommandResult runTimedCmdWithInput (long timeout, String input, File stdoutFile, File stderrFile, String... command)
システム コマンドを実行するヘルパー メソッド。指定された時間より長くかかった場合は中止し、指定された場合は出力をファイルにリダイレクトします。
| パラメータ | |
|---|---|
timeout |
long: タイムアウトの最大待機時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
input |
String: プロセスに渡す stdin 入力 |
stdoutFile |
File: 標準出力がリダイレクトされる File。null の場合もあります。 |
stderrFile |
File: エラー出力がリダイレクトされる File。null の場合もあります。 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdWithInputRedirect
public abstract CommandResult runTimedCmdWithInputRedirect (long timeout, File inputRedirect, String... command)
ファイルから Stdin をリダイレクトする必要があるシステム コマンドを実行し、指定した時間よりも長くかかった場合は中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
inputRedirect |
File: ProcessBuilder.redirectInput() を使用して標準入力としてリダイレクトする File。null の場合、stdin はリダイレクトされません。 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdWithOutputMonitor
public abstract CommandResult runTimedCmdWithOutputMonitor (long timeout, long idleOutputTimeout, String... command)
システム コマンドを実行し、指定した時間を超えた場合は中止するヘルパー メソッド。また、出力ストリームのアクティビティもモニタリングし、指定した時間内にストリーム アクティビティが検出されない場合は中止します。idleOutputTimeout がゼロに設定されている場合、ストリーム モニタリングは行われません。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedCmdWithOutputMonitor
public abstract CommandResult runTimedCmdWithOutputMonitor (long timeout, long idleOutputTimeout, OutputStream stdout, OutputStream stderr, String... command)
システム コマンドを実行するヘルパー メソッド。指定された時間より長くかかった場合は中止し、指定された場合は出力をファイルにリダイレクトします。このように OutputStream が指定されている場合、関数が終了しても開いたままになります。
| パラメータ | |
|---|---|
timeout |
long: タイムアウトの最大待機時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
stdout |
OutputStream: 標準出力がリダイレクトされる OutputStream。null の場合もあります。 |
stderr |
OutputStream: エラー出力がリダイレクトされる OutputStream。null の場合もあります。 |
command |
String: 指定されたシステム コマンドと、必要に応じて実行する引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンド実行の結果を含む CommandResult |
runTimedRetry
public abstract boolean runTimedRetry (long opTimeout,
long pollInterval,
int attempts,
IRunUtil.IRunnableResult runnable)成功するまでオペレーションを複数回ブロックして実行します。
| パラメータ | |
|---|---|
opTimeout |
long: 1 回のオペレーション試行で待機する最大時間(ミリ秒単位) |
pollInterval |
long: コマンドの再試行の間に待機する時間 |
attempts |
int: 試行する最大回数 |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
| 戻り値 | |
|---|---|
boolean |
試行回数に達する前にオペレーションが正常に完了した場合は true。 |
runTimedRetryWithOutputMonitor
public abstract boolean runTimedRetryWithOutputMonitor (long opTimeout,
long idleOutputTimeout,
long pollInterval,
int attempts,
IRunUtil.IRunnableResult runnable)オペレーションが成功するまで、オペレーションを複数回ブロックして実行します。また、出力ストリームのアクティビティもモニタリングし、指定した時間内にストリーム アクティビティが検出されない場合は中止します。idleOutputTimeout がゼロに設定されている場合、ストリーム モニタリングは行われません。
| パラメータ | |
|---|---|
opTimeout |
long: 1 回のオペレーション試行で待機する最大時間(ミリ秒単位) |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
pollInterval |
long: コマンドの再試行の間に待機する時間 |
attempts |
int: 試行する最大回数 |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
| 戻り値 | |
|---|---|
boolean |
試行回数に達する前にオペレーションが正常に完了した場合は true。 |
runTimedWithOutputMonitor
public abstract CommandStatus runTimedWithOutputMonitor (long timeout, long idleOutputTimeout, IRunUtil.IRunnableResult runnable, boolean logErrors)
オペレーションをブロックして実行し、指定した時間を超えた場合は中止します。また、出力ストリームのアクティビティもモニタリングし、指定した時間内にストリーム アクティビティが検出されない場合は中止します。idleOutputTimeout がゼロに設定されている場合、ストリーム モニタリングは行われません。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
logErrors |
boolean: 例外でエラーをログに記録するかどうか。 |
| 戻り値 | |
|---|---|
CommandStatus |
オペレーションの CommandStatus 結果。 |
setEnvVariable
public abstract void setEnvVariable (String key,
String value)システム コマンドの実行時に使用される環境変数を設定します。
| パラメータ | |
|---|---|
key |
String: 変数名 |
value |
String: 変数の値 |
setEnvVariablePriority
public abstract void setEnvVariablePriority (IRunUtil.EnvPriority priority)
プロセスを作成するときに、環境変数の設定よりも設定解除の優先度を高くするかどうかを決定します。デフォルトでは、設定解除の優先度が高くなります。つまり、同じ名前の変数を設定しようとしても、変数が設定解除されるため、設定は行われません。デフォルトの IRunUtil インスタンスでは使用できません。
| パラメータ | |
|---|---|
priority |
IRunUtil.EnvPriority |
setInterruptibleInFuture
public abstract void setInterruptibleInFuture (Thread thread,
long timeMs)一定の待機時間の後に割り込み可能として設定します。ERROR(/CommandScheduler#shutdownHard()) を使用して、最終的に終了するようにします。
| パラメータ | |
|---|---|
thread |
Thread: 割り込み可能になるスレッド。 |
timeMs |
long: 中断可能に設定するまでの待機時間。 |
setLinuxInterruptProcess
public abstract void setLinuxInterruptProcess (boolean interrupt)
タイムアウトに達したときに #runTimed メソッドで実行されているプロセスで Linux の「kill」割り込みを使用できるようにします。デフォルトの IRunUtil インスタンスでは使用できません。
| パラメータ | |
|---|---|
interrupt |
boolean |
setRedirectStderrToStdout
public abstract void setRedirectStderrToStdout (boolean redirect)
システム コマンドの実行時に標準エラー ストリームが標準出力ストリームにリダイレクトされるように設定します。初期値は false です。
| パラメータ | |
|---|---|
redirect |
boolean: リダイレクトするかどうかの新しい値 |
setWorkingDir
public abstract void setWorkingDir (File dir)
システム コマンドの作業ディレクトリを設定します。
| パラメータ | |
|---|---|
dir |
File: 作業ディレクトリ |
sleep
public abstract void sleep (long time)
例外を無視して、指定された時間だけスリープするヘルパー メソッド。
| パラメータ | |
|---|---|
time |
long: スリープするまでの時間(ミリ秒単位)。0 以下の値は無視されます |
unsetEnvVariable
public abstract void unsetEnvVariable (String key)
環境変数の設定を解除します。これにより、システム コマンドはこの環境変数なしで実行されます。
| パラメータ | |
|---|---|
key |
String: 変数名 |