r01f.process
Class TimeOutController

java.lang.Object
  extended by r01f.process.TimeOutController

public class TimeOutController
extends java.lang.Object


Nested Class Summary
static class TimeOutController.TimeoutException
          Signals that the task timed out.
 
Constructor Summary
private TimeOutController()
          No instanciar métodos de esta clase.
 
Method Summary
static void execute(java.lang.Runnable task, long timeout)
          Ejecuta la tarea en un nuevo deamon Thread y espera el tiempo especificado en el timeout.
static void execute(java.lang.Thread task, long timeout)
          Ejecuta la tarea y espera los milisegundos especificados en timeout para devolver Si la tarea no retorna en el número de milisegundos especificado, el thread se interrumpe y se lanza una excepción El llamante debe sobrecarga el método Thread.interrupt() para hacer algo que mate el thread o bien utilice el método Thread.isInterrupted();
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeOutController

private TimeOutController()
No instanciar métodos de esta clase.

Method Detail

execute

public static void execute(java.lang.Thread task,
                           long timeout)
                    throws TimeOutController.TimeoutException
Ejecuta la tarea y espera los milisegundos especificados en timeout para devolver Si la tarea no retorna en el número de milisegundos especificado, el thread se interrumpe y se lanza una excepción El llamante debe sobrecarga el método Thread.interrupt() para hacer algo que mate el thread o bien utilice el método Thread.isInterrupted();

Parameters:
task: - La tarea a ejecutar
timeout: - El timeout a esperar a que el thread retorne. 0 significa esperar para siempre
Throws:
TimeOutController.TimeoutException - si se cumple el timeout y el thread no ha retornado.

execute

public static void execute(java.lang.Runnable task,
                           long timeout)
                    throws TimeOutController.TimeoutException
Ejecuta la tarea en un nuevo deamon Thread y espera el tiempo especificado en el timeout.

Parameters:
task: - La tarea a ejecutar
timeout: - El timeout en milisegundos. 0 significa esperar para siempre
Throws:
TimeoutException: - si pasa el tiempo especificado y la tarea no ha retornado
TimeOutController.TimeoutException