コマンドインタラプタ

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

シングルトン。

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

コマンドインタラプタ

public CommandInterrupter ()

公開メソッド

許可割り込み

public void allowInterrupt ()

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

allowInterruptAsync

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

指定されたスレッドが遅延後に中断されることを許可します。

パラメーター
thread Thread : 割り込み可能としてマークするスレッド

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

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

戻り値

ブロック割り込み

public void blockInterrupt ()

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

チェック中断

public void checkInterrupted ()

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

スロー
RunInterruptedException

割り込み

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

スレッドにフラグを立て、割り込み可能になった場合に割り込みます。

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

message String : 中断メッセージ

errorId ErrorIdentifier

割り込み可能

public boolean isInterruptible (Thread thread)

パラメーター
thread Thread

戻り値
boolean指定されたスレッドが割り込み可能な場合は true

割り込み可能

public boolean isInterruptible ()

戻り値
boolean現在のスレッドが割り込み可能な場合は true