Alarm

public class Alarm
extends Thread

java.lang.Object
   ↳ java.lang.Thread
     ↳ com.android.tradefed.util.Alarm


A thread which waits for a period of time and then interrupts a specific other thread. Can call Thread.interrupt() to get a thread out of a blocking wait, or Socket.close() to stop a thread from blocking on a socket read or write.

All time units are in milliseconds.

Summary

Public constructors

Alarm(long timeout)

Constructor takes the amount of time to wait, in millis.

Public methods

void addSocket(Socket intSocket)
void addThread(Thread intThread)
boolean didAlarmFire()
void run()

Public constructors

Alarm

public Alarm (long timeout)

Constructor takes the amount of time to wait, in millis.

Parameters
timeout long: The amount of time to wait, in millis

Throws
IllegalArgumentException if timeout <= 0.

Public methods

addSocket

public void addSocket (Socket intSocket)

Parameters
intSocket Socket

addThread

public void addThread (Thread intThread)

Parameters
intThread Thread

didAlarmFire

public boolean didAlarmFire ()

Returns
boolean

run

public void run ()