CommandInterrupter

public class CommandInterrupter
extends Object

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


บริการที่อนุญาตให้ขัดจังหวะคําสั่ง TradeFederation หรือทําเครื่องหมายว่าไม่สามารถขัดจังหวะได้

สรุป

ช่อง

public static final CommandInterrupter INSTANCE

Singleton

ตัวสร้างแบบสาธารณะ

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()

ช่อง

อินสแตนซ์

public static final CommandInterrupter INSTANCE

Singleton

ตัวสร้างแบบสาธารณะ

CommandInterrupter

public CommandInterrupter ()

เมธอดสาธารณะ

allowInterrupt

public void allowInterrupt ()

อนุญาตให้มีการขัดจังหวะชุดข้อความปัจจุบัน

allowInterruptAsync

public  allowInterruptAsync (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 จริงหากเธรดที่ระบุสามารถขัดจังหวะได้

isInterruptible

public boolean isInterruptible ()

คิกรีเทิร์น
boolean จริงหากชุดข้อความปัจจุบันหยุดชะงักได้