CommandInterrupter

public class CommandInterrupter
extends Object

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


Serviço que permite que os comandos do TradeFederation sejam interrompidos ou marcados como não interrompíveis.

Resumo

Campos

public static final CommandInterrupter INSTANCE

Singleton.

Construtores públicos

CommandInterrupter()

Métodos públicos

void allowInterrupt()

Permitir que a thread atual seja interrompida.

Future<?> allowInterruptAsync(Thread thread, long delay, TimeUnit unit)

Permitir que uma thread especificada seja interrompida após um atraso.

void blockInterrupt()

Impedir que a thread atual seja interrompida.

void checkInterrupted()

Interrompe a thread atual se ela precisar ser interrompida.

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

Marcar uma thread, interrompendo-a se e quando ela se tornar interrompível.

boolean isInterruptible(Thread thread)
boolean isInterruptible()

Campos

INSTÂNCIA

public static final CommandInterrupter INSTANCE

Singleton.

Construtores públicos

CommandInterrupter

public CommandInterrupter ()

Métodos públicos

allowInterrupt

public void allowInterrupt ()

Permitir que a thread atual seja interrompida.

allowInterruptAsync

public Future<?> allowInterruptAsync (Thread thread, 
                long delay, 
                TimeUnit unit)

Permitir que uma thread especificada seja interrompida após um atraso.

Parâmetros
thread Thread: thread a ser marcada como interrompível

delay long: tempo a partir de agora para atrasar a execução

unit TimeUnit: unidade de tempo do parâmetro de atraso

Retorna
Future<?>

blockInterrupt

public void blockInterrupt ()

Impedir que a thread atual seja interrompida.

checkInterrupted

public void checkInterrupted ()

Interrompe a thread atual se ela precisar ser interrompida. É recomendável que as threads chamem esse método periodicamente para gerar a RunInterruptedException correta.

Gera
RunInterruptedException

interrupt

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

Marcar uma thread, interrompendo-a se e quando ela se tornar interrompível.

Parâmetros
thread Thread: thread a ser marcada para interrupção

message String: mensagem de interrupção

errorId ErrorIdentifier

isInterruptible

public boolean isInterruptible (Thread thread)

Parâmetros
thread Thread

Retorna
boolean verdadeiro se a thread especificada for interrompível

isInterruptible

public boolean isInterruptible ()

Retorna
boolean verdadeiro se a thread atual for interrompível