javax.realtime
Class Timed

java.lang.Object
  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.InterruptedException
              extended byjavax.realtime.AsynchronouslyInterruptedException
                  extended byjavax.realtime.Timed
All Implemented Interfaces:
Serializable

public class Timed
extends AsynchronouslyInterruptedException

Perform a computation (or subcomputation) that will be interrupted after a specified duration.

Since:
0.3.8
Author:
Morgan Deters
See Also:
Serialized Form

Constructor Summary
Timed(HighResolutionTime time)
          Constructs a new Timed.
 
Method Summary
 boolean doInterruptible(Interruptible logic)
          Start the timer, perform the computation (or subcomputation) logic, and interrupt it (if it hasn't finished) when the timer runs out.
 void resetTime(HighResolutionTime time)
          Resets the timeout for the next timed computation.
 
Methods inherited from class javax.realtime.AsynchronouslyInterruptedException
clear, disable, enable, fire, happened, isEnabled, propagate
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Timed

public Timed(HighResolutionTime time)
Constructs a new Timed.

Parameters:
time - the timeout for this Timed instance
Method Detail

doInterruptible

public boolean doInterruptible(Interruptible logic)
Start the timer, perform the computation (or subcomputation) logic, and interrupt it (if it hasn't finished) when the timer runs out.

Overrides:
doInterruptible in class AsynchronouslyInterruptedException
Parameters:
logic - the timed computation to perform
Returns:
true if the computation is interrupted; false if it finishes normally

resetTime

public void resetTime(HighResolutionTime time)
Resets the timeout for the next timed computation.

Parameters:
time - the new timeout for this Timed instance


jRate is developed and maintained by the jRate project development team.
Copyright (c) 2001-2006 Angelo Corsaro and Morgan Deters.