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(Redirect redirect,
|
abstract
Process
|
runCmdInBackground(
|
abstract
Process
|
runCmdInBackground(
|
abstract
Process
|
runCmdInBackground(String... command)
システム コマンドを非同期で実行するヘルパー メソッド。 |
abstract
Process
|
runCmdInBackground(Redirect redirect, String... command)
システム コマンドを非同期で実行するヘルパー メソッド。 |
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, OutputStream stdout, OutputStream stderr, String... command)
システム コマンドを実行し、指定された時間を超えると中止し、指定されている場合は出力をファイルにリダイレクトするヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmd(long timeout, 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, File stdoutFile, File stderrFile, String... command)
システム コマンドを実行し、指定された時間を超えると中止し、指定されている場合は出力をファイルにリダイレクトするヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithInput(long timeout, String input, String... command)
stdin 入力を必要とするシステム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithInput(long timeout, String input,
stdin 入力を必要とするシステム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithInputRedirect(long timeout, File inputRedirect, String... command)
ファイルから Stdin をリダイレクトする必要があるシステム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithOutputMonitor(long timeout, long idleOutputTimeout, OutputStream stdout, OutputStream stderr, String... command)
システム コマンドを実行し、指定された時間を超えると中止し、指定されている場合は出力をファイルにリダイレクトするヘルパー メソッド。 |
abstract
CommandResult
|
runTimedCmdWithOutputMonitor(long timeout, long idleOutputTimeout, 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 |
実行を中断できる場合は true、それ以外の場合は false。 |
runCmdInBackground
public abstract Process runCmdInBackground (Redirect redirect,
command) ERROR(/List) 形式のコマンド引数を受け取る代替の runCmdInBackground(String) メソッド。
| パラメータ | |
|---|---|
redirect |
Redirect: ProcessBuilder に適用する ERROR(/Redirect)。 |
command |
: 指定されたシステム コマンドと、必要に応じて実行する引数を含む ERROR(/List) |
| 戻り値 | |
|---|---|
Process |
実行されたコマンドの Process |
| 例外 | |
|---|---|
|
コマンドが実行されなかった場合 |
runCmdInBackground
public abstract Process runCmdInBackground (command)
ERROR(/List) 形式のコマンド引数を受け取る代替の runCmdInBackground(String) メソッド。
| パラメータ | |
|---|---|
command |
: 指定されたシステム コマンドと、必要に応じて実行する引数を含む ERROR(/List) |
| 戻り値 | |
|---|---|
Process |
実行されたコマンドの Process |
| 例外 | |
|---|---|
|
コマンドが実行されなかった場合 |
runCmdInBackground
public abstract Process runCmdInBackground (command, OutputStream output)
ERROR(/OutputStream) を指定してコマンドを実行すると、コマンドの出力がログに記録されます。stdout と stderr が統合されます。
| パラメータ | |
|---|---|
command |
: 実行するコマンド |
output |
OutputStream: 出力を保存する OutputStream |
| 戻り値 | |
|---|---|
Process |
コマンドを実行している Process |
| 例外 | |
|---|---|
|
IOException |
runCmdInBackground
public abstract Process runCmdInBackground (String... command)
システム コマンドを非同期で実行するヘルパー メソッド。
コマンドの起動直後に返されます。
| パラメータ | |
|---|---|
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
Process |
実行されたコマンドの Process |
| 例外 | |
|---|---|
|
コマンドが実行されなかった場合 |
runCmdInBackground
public abstract Process runCmdInBackground (Redirect redirect,
String... command)システム コマンドを非同期で実行するヘルパー メソッド。
コマンドの起動直後に返されます。
| パラメータ | |
|---|---|
redirect |
Redirect: ProcessBuilder に適用する ERROR(/Redirect)。 |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
Process |
実行されたコマンドの Process |
| 例外 | |
|---|---|
|
コマンドが実行されなかった場合 |
runEscalatingTimedRetry
public abstract boolean runEscalatingTimedRetry (long opTimeout,
long initialPollInterval,
long maxPollInterval,
long maxTime,
IRunUtil.IRunnableResult runnable)オペレーションが成功するまで、オペレーションをブロックして複数回実行します。
オペレーションの試行間の待機時間を指数関数的に増やします。これは、サーバーのポーリングなどのオペレーションを実行するときに使用し、サーバーが一時的に停止した場合に復旧する時間を確保することを目的としています。
| パラメータ | |
|---|---|
opTimeout |
long: 1 回のオペレーションの試行で待機する最大時間(ミリ秒) |
initialPollInterval |
long: オペレーションの試行の間に待機する初期時間 |
maxPollInterval |
long: オペレーションの試行の間に待機する最大時間 |
maxTime |
long: オペレーションの再試行を続ける合計推定最大時間 |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
| 戻り値 | |
|---|---|
boolean |
true(maxTime が期限切れになる前にオペレーションが正常に完了した場合) |
runFixedTimedRetry
public abstract boolean runFixedTimedRetry (long opTimeout,
long pollInterval,
long maxTime,
IRunUtil.IRunnableResult runnable)オペレーションが成功するまで、オペレーションをブロックして複数回実行します。
| パラメータ | |
|---|---|
opTimeout |
long: 1 回のオペレーションの試行で待機する最大時間(ミリ秒) |
pollInterval |
long: オペレーションの試行の間に待機する初期時間 |
maxTime |
long: オペレーションの再試行を続ける合計推定最大時間 |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
| 戻り値 | |
|---|---|
boolean |
true(maxTime が期限切れになる前にオペレーションが正常に完了した場合) |
runFixedTimedRetryWithOutputMonitor
public abstract boolean runFixedTimedRetryWithOutputMonitor (long opTimeout,
long idleOutputTimeout,
long pollInterval,
long maxTime,
IRunUtil.IRunnableResult runnable)オペレーションが成功するまで、オペレーションをブロックして複数回実行します。また、出力ストリームのアクティビティをモニタリングし、指定した時間ストリーム アクティビティが検出されなかった場合は中止します。idleOutputTimeout がゼロに設定されている場合、ストリーム モニタリングは行われません。
| パラメータ | |
|---|---|
opTimeout |
long: 1 回のオペレーションの試行で待機する最大時間(ミリ秒) |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
pollInterval |
long: オペレーションの試行の間に待機する初期時間 |
maxTime |
long: オペレーションの再試行を続ける合計推定最大時間 |
runnable |
IRunUtil.IRunnableResult: 実行する IRunUtil.IRunnableResult |
| 戻り値 | |
|---|---|
boolean |
true(maxTime が期限切れになる前にオペレーションが正常に完了した場合) |
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, OutputStream stdout, OutputStream stderr, String... command)
システム コマンドを実行し、指定された時間を超えると中止し、指定されている場合は出力をファイルにリダイレクトするヘルパー メソッド。このように ERROR(/OutputStream) を指定すると、関数の終了時に開いたままになります。
| パラメータ | |
|---|---|
timeout |
long: 待機するタイムアウトの最大時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
stdout |
OutputStream: 標準出力がリダイレクトされる ERROR(/OutputStream)。null の場合もあります。 |
stderr |
OutputStream: エラー出力がリダイレクトされる ERROR(/OutputStream)。null の場合もあります。 |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンドの実行結果を含む CommandResult |
runTimedCmd
public abstract CommandResult runTimedCmd (long timeout, String... command)
システム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンドの実行結果を含む CommandResult |
runTimedCmdRetry
public abstract CommandResult runTimedCmdRetry (long timeout, long retryInterval, int attempts, String... command)
システム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 各試行で待機する最大時間(ミリ秒) |
retryInterval |
long: コマンドの再試行の間に待機する時間 |
attempts |
int: 試行する最大回数 |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
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: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンドの実行結果を含む CommandResult |
runTimedCmdSilently
public abstract CommandResult runTimedCmdSilently (long timeout, String... command)
システム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。runTimedCmd(long, String) に似ていますが、例外でエラーをログに記録しません。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
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: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
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: 標準出力がリダイレクトされる ERROR(/File)。null の場合もあります。 |
stderrFile |
File: エラー出力がリダイレクトされる ERROR(/File)。null の場合もあります。 |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンドの実行結果を含む CommandResult |
runTimedCmdWithInput
public abstract CommandResult runTimedCmdWithInput (long timeout, String input, String... command)
stdin 入力を必要とするシステム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
input |
String: プロセスに渡す stdin 入力 |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンドの実行結果を含む CommandResult |
runTimedCmdWithInput
public abstract CommandResult runTimedCmdWithInput (long timeout, String input,command)
stdin 入力を必要とするシステム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
input |
String: プロセスに渡す stdin 入力 |
command |
: システム コマンドと、必要に応じて実行する引数を含む ERROR(/List) |
| 戻り値 | |
|---|---|
CommandResult |
コマンドの実行結果を含む CommandResult |
runTimedCmdWithInputRedirect
public abstract CommandResult runTimedCmdWithInputRedirect (long timeout, File inputRedirect, String... command)
ファイルから Stdin をリダイレクトする必要があるシステム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒) |
inputRedirect |
File: ProcessBuilder.redirectInput() を使用して標準入力としてリダイレクトする ERROR(/File)。null の場合、stdin はリダイレクトされません。 |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンドの実行結果を含む CommandResult |
runTimedCmdWithOutputMonitor
public abstract CommandResult runTimedCmdWithOutputMonitor (long timeout, long idleOutputTimeout, OutputStream stdout, OutputStream stderr, String... command)
システム コマンドを実行し、指定された時間を超えると中止し、指定されている場合は出力をファイルにリダイレクトするヘルパー メソッド。このように ERROR(/OutputStream) を指定すると、関数の終了時に開いたままになります。
| パラメータ | |
|---|---|
timeout |
long: 待機するタイムアウトの最大時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
stdout |
OutputStream: 標準出力がリダイレクトされる ERROR(/OutputStream)。null の場合もあります。 |
stderr |
OutputStream: エラー出力がリダイレクトされる ERROR(/OutputStream)。null の場合もあります。 |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
CommandResult |
コマンドの実行結果を含む CommandResult |
runTimedCmdWithOutputMonitor
public abstract CommandResult runTimedCmdWithOutputMonitor (long timeout, long idleOutputTimeout, String... command)
システム コマンドを実行し、指定された時間を超えると中止するヘルパー メソッド。また、出力ストリームのアクティビティをモニタリングし、指定した時間内にストリーム アクティビティが検出されなかった場合は中止します。idleOutputTimeout がゼロに設定されている場合、ストリーム モニタリングは行われません。
| パラメータ | |
|---|---|
timeout |
long: 待機する最大時間(ミリ秒単位)。0 はタイムアウトなしを意味します。 |
idleOutputTimeout |
long: 出力ストリームの出力を待機する最大時間(ミリ秒) |
command |
String: 指定されたシステム コマンドと、必要に応じて exec の引数 |
| 戻り値 | |
|---|---|
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: 変数名 |