CommandInterrupter

public class CommandInterrupter
extends Object

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


Dịch vụ cho phép gián đoạn các lệnh TradeFederation hoặc đánh dấu là không gián đoạn được.

Tóm tắt

Trường

public static final CommandInterrupter INSTANCE

Singleton.

Hàm khởi tạo công khai

CommandInterrupter()

Phương thức công khai

void allowInterrupt()

Cho phép gián đoạn luồng hiện tại.

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

Cho phép gián đoạn một luồng được chỉ định sau một khoảng thời gian trễ.

void blockInterrupt()

Ngăn gián đoạn luồng hiện tại.

void checkInterrupted()

Gián đoạn luồng hiện tại nếu cần gián đoạn.

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

Gắn cờ một luồng, gián đoạn luồng đó nếu và khi luồng đó có thể gián đoạn.

boolean isInterruptible(Thread thread)
boolean isInterruptible()

Trường

INSTANCE

public static final CommandInterrupter INSTANCE

Singleton.

Hàm khởi tạo công khai

CommandInterrupter

public CommandInterrupter ()

Phương thức công khai

allowInterrupt

public void allowInterrupt ()

Cho phép gián đoạn luồng hiện tại.

allowInterruptAsync

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

Cho phép gián đoạn một luồng được chỉ định sau một khoảng thời gian trễ.

Tham số
thread Thread: luồng cần đánh dấu là có thể gián đoạn

delay long: thời gian từ bây giờ để trì hoãn việc thực thi

unit TimeUnit: đơn vị thời gian của tham số trễ

Giá trị trả về
Future<?>

blockInterrupt

public void blockInterrupt ()

Ngăn gián đoạn luồng hiện tại.

checkInterrupted

public void checkInterrupted ()

Gián đoạn luồng hiện tại nếu cần gián đoạn. Các luồng nên định kỳ gọi phương thức này để gửi RunInterruptedException phù hợp.

Gửi
RunInterruptedException

interrupt

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

Gắn cờ một luồng, gián đoạn luồng đó nếu và khi luồng đó có thể gián đoạn.

Tham số
thread Thread: luồng cần đánh dấu để gián đoạn

message String: thông báo gián đoạn

errorId ErrorIdentifier

isInterruptible

public boolean isInterruptible (Thread thread)

Tham số
thread Thread

Giá trị trả về
boolean true nếu luồng được chỉ định có thể gián đoạn

isInterruptible

public boolean isInterruptible ()

Giá trị trả về
boolean true nếu luồng hiện tại có thể gián đoạn