se.lth.cs.realtime
Class ActivityImpl

java.lang.Object
  extended byse.lth.cs.realtime.ActivityImpl
All Implemented Interfaces:
Activity

public final class ActivityImpl
extends java.lang.Object
implements Activity

Let a java.lang.Thread object be treated as an Activity, which it (almost) is even if that interface (in se.lth.cs.realtime)is not implemented (in java.lang). Also threads that already implements Activity (instances of JThread and RTThread) can be wrapped, thereby ensuring that the constructor always returns a valid activity.

See Also:
License

Constructor Summary
ActivityImpl()
          Create an activity representing the currently executing thread.
ActivityImpl(RTThread thread)
          Create an activity object, that we already have, for completeness.
ActivityImpl(java.lang.Thread thread)
          Make an activity out of a Java thread.
 
Method Summary
 Environment getEnv()
           
 java.lang.Object getThread()
          Not part of the Activity interface, obtain the represented Thread or RTThread.
 Timebase getTimebase()
           
 boolean isAlive()
          Calls isAlive for the represented thread.
 void join()
          Calls isAlive for the represented thread.
 void start()
          Calls isAlive for the represented thread.
 void terminate()
          Interrupt and join the represented thread.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivityImpl

public ActivityImpl()
Create an activity representing the currently executing thread.


ActivityImpl

public ActivityImpl(java.lang.Thread thread)
Make an activity out of a Java thread.

Parameters:
thread - the Java thread to represent.

ActivityImpl

public ActivityImpl(RTThread thread)
Create an activity object, that we already have, for completeness.

Parameters:
thread - the RTThread to be wrapped.
Method Detail

getThread

public java.lang.Object getThread()
Not part of the Activity interface, obtain the represented Thread or RTThread. The intended use of this class is only for ActivityEvents and configuration of activities. For example, to support obtaining the actual thread in RTEvent, to have the source and owner attributes referring to the actual thread objects, the RTEvent base class will use this method. Similar need might appear outside this package, hence the protected visibility.

Returns:
the (real-time or Java) tread object.

getEnv

public Environment getEnv()
Specified by:
getEnv in interface Activity
See Also:
Activity.getEnv()

getTimebase

public Timebase getTimebase()
Specified by:
getTimebase in interface Activity
See Also:
Activity.getTimebase()

isAlive

public boolean isAlive()
Calls isAlive for the represented thread.

Specified by:
isAlive in interface Activity
See Also:
Activity.isAlive(), Thread.isAlive()

join

public void join()
          throws java.lang.InterruptedException
Calls isAlive for the represented thread.

Specified by:
join in interface Activity
Throws:
java.lang.InterruptedException
See Also:
Activity.isAlive(), Thread.isAlive()

start

public void start()
Calls isAlive for the represented thread.

Specified by:
start in interface Activity
See Also:
Thread.isAlive(), Thread.isAlive()

terminate

public void terminate()
Interrupt and join the represented thread.

Specified by:
terminate in interface Activity
See Also:
Activity.terminate(), JThread.terminate()