CommandInterrupter

public class CommandInterrupter
extends Object

java.lang.Object
   ↳ com.android.tradefed.command.CommandInterrupter


TradeFederation コマンドを中断したり、中断不可としてマークしたりできるサービス。

概要

フィールド

public static final CommandInterrupter INSTANCE

シングルトン。

パブリック コンストラクタ

CommandInterrupter()

パブリック メソッド

void allowInterrupt()

現在のスレッドの中断を許可します。

allowInterruptAsync(Thread thread, long delay, TimeUnit unit)

指定したスレッドを遅延後に中断できるようにします。

void blockInterrupt()

現在のスレッドが中断されないようにする。

void checkInterrupted()

中断する必要がある場合は、現在のスレッドを中断します。

void interrupt(Thread thread, String message, ErrorIdentifier errorId)

スレッドにフラグを設定し、中断可能になったら中断します。

boolean isInterruptible(Thread thread)
boolean isInterruptible()

フィールド

インスタンス

public static final CommandInterrupter INSTANCE

シングルトン。

パブリック コンストラクタ

CommandInterrupter

public CommandInterrupter ()

パブリック メソッド

allowInterrupt

public void allowInterrupt ()

現在のスレッドの中断を許可します。

allowInterruptAsync

public  allowInterruptAsync (Thread thread, 
                long delay, 
                TimeUnit unit)

指定したスレッドを遅延後に中断できるようにします。

パラメータ
thread Thread: 中断可能としてマークするスレッド

delay long: 実行を遅らせる時間

unit TimeUnit: 遅延パラメータの時間単位

戻り値

blockInterrupt

public void blockInterrupt ()

現在のスレッドが中断されないようにする。

checkInterrupted

public void checkInterrupted ()

中断する必要がある場合は、現在のスレッドを中断します。スレッドは、適切な RunInterruptedException をスローするために、このメソッドを定期的に呼び出すことをおすすめします。

例外
RunInterruptedException

割り込み

public void interrupt (Thread thread, 
                String message, 
                ErrorIdentifier errorId)

スレッドにフラグを設定し、中断可能になったら中断します。

パラメータ
thread Thread: 中断をマークするスレッド

message String: 中断メッセージ

errorId ErrorIdentifier

isInterruptible

public boolean isInterruptible (Thread thread)

パラメータ
thread Thread

戻り値
boolean 指定されたスレッドが中断可能であれば true

isInterruptible

public boolean isInterruptible ()

戻り値
boolean 現在のスレッドが中断可能であれば true