CommandInterrupter

public class CommandInterrupter
extends Object

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


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

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.

allowInterruptAsync(Thread thread, long delay, TimeUnit unit)

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

void blockInterrupt()

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

void checkInterrupted()

Gián đoạn luồng hiện tại nếu luồng đó bị gián đoạn.

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

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

boolean isInterruptible(Thread thread)
boolean isInterruptible()

Trường

MẪU

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  allowInterruptAsync (Thread thread, 
                long delay, 
                TimeUnit unit)

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

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

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

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

Giá trị trả về

blockInterrupt

public void blockInterrupt ()

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

checkInterrupted

public void checkInterrupted ()

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

Gửi
RunInterruptedException

ngắt

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

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

Tham số
thread Thread: luồng để đánh dấu cho việc 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ể bị gián đoạn

isInterruptible

public boolean isInterruptible ()

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