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()
|
欄位
公用建構函式
CommandInterrupter
public CommandInterrupter ()
公用方法
allowInterrupt
public void allowInterrupt ()
允許中斷目前的執行緒。
allowInterruptAsync
publicallowInterruptAsync (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 |