aicas logoJamaica 6.4 release 1

javax.realtime
Class Timed

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

public class Timed
extends AsynchronouslyInterruptedException

Jamaica Real-Time Specification for Java class Timed.

Timed is a subclass of AsynchronouslyInterruptedException that permit the execution of code provided in an instance of Interruptible with a given time out. After the time out is reached, the code will be interrupted by throwing this instance of AsynchronouslyInterruptedException.

No memory allocation will be performed after the creation of this Timed instance, several invocation of doInterruptible may hence be performed without additional memory allocation.

See Also:
Serialized Form

Constructor Summary
Timed(HighResolutionTime time)
          Constructor to create a new instance of Timed with the given time out.
 
Method Summary
 boolean doInterruptible(Interruptible logic)
          doInterruptible executes the run() method of the provided Interruptible logic with the time-out provided to the constructor of this Timed or set via resetTime.
 void resetTime(HighResolutionTime time)
          resetTime sets the time out for the next invocation of doInterruptible to a new value.
 
Methods inherited from class javax.realtime.AsynchronouslyInterruptedException
clear, disable, enable, fire, getGeneric, 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)
      throws IllegalArgumentException

Constructor to create a new instance of Timed with the given time out.

Parameters:
time - the timeout when the execution the Interruptible logic should be stopped.
Throws:
IllegalArgumentException - if time is null.
Method Detail

doInterruptible

public boolean doInterruptible(Interruptible logic)
doInterruptible executes the run() method of the provided Interruptible logic with the time-out provided to the constructor of this Timed or set via resetTime.

Overrides:
doInterruptible in class AsynchronouslyInterruptedException
Parameters:
logic - Contains the run() method that specifies the logic to be executed in an interruptible way.
Returns:
false iff this call failed since this Timed instance is currently running a call to doInterruptible for the current or a different thread.
Throws:
IllegalArgumentException - iff the provided logic parameter is null.

resetTime

public void resetTime(HighResolutionTime time)
resetTime sets the time out for the next invocation of doInterruptible to a new value.

Parameters:
time - the new time out. It may be null to keep the time out unchanged.

aicas logoJamaica 6.4 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2015 aicas GmbH. All Rights Reserved.