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 |