|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
javax.realtime.RealtimeThread
RealtimeThread
extends
java.lang.Thread
and includes classes and methods to get
and set parameter objects, manage the execution of those threads with a
ReleaseParameters
type of
PeriodicParameters
, and
waiting.
A RealtimeThread
object must be
placed in a memory area such that thread logic may unexceptionally access
instance variables and such that Java methods on java.lang.Thread
(e.g., enumerate and join) complete normally except where such execution may
cause access violations.
Parameters for constructors may be
null
. In such cases the default
value will be the default value set for the particular type by the associated
instance of Scheduler
.
Field Summary | |
boolean |
activePhaseToDo
True iff this RealtimeThread is
executing an active phase, i.e., is the coroutine currently under execution in
this DSS . |
EventNotice |
currentEventNotice
Points to the unique EventNotice for
this RealtimeThread . |
int |
currentPriority
The current priority of this RealtimeThread ,
which may temporarily be greater than its base priority, due to priority inheritance. |
static int |
defaultPriority
|
protected AbsoluteTime |
endTime
|
protected double |
lastPriorityChangeNanos
|
protected AbsoluteTime |
lastWaitStart
|
protected java.lang.Runnable |
logic
Not passed to superclass because we need to maintain two run() functions: the one in this RealtimeThread, and the one provided by constructor argument |
protected MemoryArea |
memoryArea
This RealtimeThread 's
MemoryArea . |
protected MemoryParameters |
memoryParameters
This RealtimeThread 's
MemoryParameters . |
protected ProcessingGroupParameters |
processingGroup
This RealtimeThread 's
ProcessingGroupParameters . |
protected ReleaseParameters |
releaseParameters
This RealtimeThread 's
ReleaseParameters . |
java.util.Set |
resourcesHeld
The set of resources currently held by this RealtimeThread . |
protected Scheduler |
scheduler
This RealtimeThread 's
Scheduler . |
protected SchedulingParameters |
scheduling
This RealtimeThread 's
Scheduler . |
protected long |
startAbsoluteMillis
The milliseconds of this RealtimeThread 's
start cost. |
boolean |
started
True iff this RealtimeThread has
started, i.e., begun its run() routine. |
protected AbsoluteTime |
startTime
The time at which this RealtimeThread started running. |
boolean |
terminated
|
protected double |
timeWeightedPriority
|
Resource |
waitingForResource
The resource, if any, that this RealtimeThread is currently
waiting for. |
protected RelativeTime |
waitTime
Accumulates time this RealtimeThread has spent
waiting for a Resource . |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
protected |
RealtimeThread()
Default constructor |
|
RealtimeThread(SchedulingParameters scheduling)
Constructor |
|
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters releaseParameters)
Constructor |
|
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters releaseParameters,
MemoryParameters memoryParameters,
MemoryArea memoryArea,
ProcessingGroupParameters processingGroup,
java.lang.Runnable logic)
Constructor |
protected |
RealtimeThread(java.lang.String name)
|
|
RealtimeThread(java.lang.String name,
SchedulingParameters scheduling)
Constructor |
|
RealtimeThread(java.lang.String name,
SchedulingParameters scheduling,
ReleaseParameters releaseParameters)
Constructor |
|
RealtimeThread(java.lang.String name,
SchedulingParameters scheduling,
ReleaseParameters releaseParameters,
MemoryParameters memoryParameters,
MemoryArea memoryArea,
ProcessingGroupParameters processingGroup,
java.lang.Runnable logic)
Constructor |
Method Summary | |
boolean |
addToFeasibility()
Add this thread to the current scheduler's feasibility set |
void |
addToWaitTime(RelativeTime time)
|
double |
averagePriority()
|
abstract void |
body()
Where all the application work gets done. |
int |
dynamicPriority()
Compute dynamic priority of this . |
void |
exit()
Exit a run method. |
int |
getBasePriority()
|
AbsoluteTime |
getLastWaitStart()
|
MemoryParameters |
getMemoryParameters()
Set this thread's memory parameters |
ProcessingGroupParameters |
getProcessingGroupParameters()
Get this thread's processing group parameters |
ReleaseParameters |
getReleaseParameters()
Get this thread's release parameters |
Scheduler |
getScheduler()
Get this thread's scheduler |
SchedulingParameters |
getSchedulingParameters()
Get this thread's scheduling parameters |
void |
initialize()
Start this thread, and wait until it has actually started. |
boolean |
isActive()
Tests whether this RealtimeThread is running
or scheduled to run later. |
void |
notifyPriorityChange(int oldPriority,
int newPriority)
|
static void |
printAllStatistics()
|
void |
printResourcesHeld()
|
void |
printStatistics()
|
void |
printTimes()
|
boolean |
removeFromFeasibility()
Remove this thread from its scheduler's feasibility set |
void |
run()
The run() method of this thread. |
void |
setLastWaitStart()
|
void |
setMemoryParameters(MemoryParameters memoryParameters)
Set this thread's memory parameters |
boolean |
setMemoryParametersIfFeasible(MemoryParameters memoryParameters)
Set this thread's memory parameters if it would still be feasible given that change |
void |
setProcessingGroupParameters(ProcessingGroupParameters processingGroup)
Set this thread's processing group parameters |
boolean |
setProcessingGroupParametersIfFeasible(ProcessingGroupParameters groupParameters)
Set this thread's processing group parameters if it would still be feasible given that change |
void |
setReleaseParameters(ReleaseParameters releaseParameters)
Set this thread's release parameters |
boolean |
setReleaseParametersIfFeasible(ReleaseParameters releaseParameters)
Set this thread's release parameters if it would still be feasible given that change |
void |
setScheduler(Scheduler scheduler)
Set this thread's scheduler |
void |
setScheduler(Scheduler scheduler,
SchedulingParameters scheduling,
ReleaseParameters releaseParameters,
MemoryParameters memoryParameters,
ProcessingGroupParameters processingGroup)
Set all the following parameters of this thread: |
void |
setSchedulingParameters(SchedulingParameters scheduling)
Set this RealtimeThread 's scheduling
parameters |
boolean |
setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
Set this thread's scheduling parameters if it would still be feasible given that change |
java.lang.String |
toString()
Construct a string representation of this thread. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int currentPriority
RealtimeThread
,
which may temporarily be greater than its base priority, due to priority inheritance.
public java.util.Set resourcesHeld
RealtimeThread
. Used in priority
inheritance calculation.
public Resource waitingForResource
RealtimeThread
is currently
waiting for.
public boolean started
RealtimeThread
has
started, i.e., begun its run()
routine.
public boolean terminated
public boolean activePhaseToDo
RealtimeThread
is
executing an active phase, i.e., is the coroutine currently under execution in
this DSS
.
public EventNotice currentEventNotice
EventNotice
for
this RealtimeThread
. Must be
null
if this
RealtimeThread
is unscheduled, i.e., passivated or terminated.
protected Scheduler scheduler
RealtimeThread
's
Scheduler
.
protected SchedulingParameters scheduling
RealtimeThread
's
Scheduler
.
protected ReleaseParameters releaseParameters
RealtimeThread
's
ReleaseParameters
.
protected MemoryParameters memoryParameters
RealtimeThread
's
MemoryParameters
.
protected MemoryArea memoryArea
RealtimeThread
's
MemoryArea
.
protected ProcessingGroupParameters processingGroup
RealtimeThread
's
ProcessingGroupParameters
.
public static final int defaultPriority
protected AbsoluteTime startTime
RealtimeThread
started running.
protected AbsoluteTime endTime
protected long startAbsoluteMillis
RealtimeThread
's
start cost.
protected RelativeTime waitTime
RealtimeThread
has spent
waiting for a Resource
.
protected double lastPriorityChangeNanos
protected double timeWeightedPriority
protected AbsoluteTime lastWaitStart
protected java.lang.Runnable logic
Constructor Detail |
protected RealtimeThread()
protected RealtimeThread(java.lang.String name)
public RealtimeThread(SchedulingParameters scheduling)
scheduling
- the
SchedulingParameters
for this objectpublic RealtimeThread(SchedulingParameters scheduling, ReleaseParameters releaseParameters)
scheduling
- the
SchedulingParameters
for this objectreleaseParameters
- the
ReleaseParameters
for this objectpublic RealtimeThread(SchedulingParameters scheduling, ReleaseParameters releaseParameters, MemoryParameters memoryParameters, MemoryArea memoryArea, ProcessingGroupParameters processingGroup, java.lang.Runnable logic)
scheduling
- the
SchedulingParameters
for this objectreleaseParameters
- the
ReleaseParameters
for this objectmemoryParameters
- the
MemoryParameters
for this objectmemoryArea
- the
MemoryArea
for this objectprocessingGroup
- the
ProcessingGroupParameters
for this objectlogic
- the Runnable
code for this objectpublic RealtimeThread(java.lang.String name, SchedulingParameters scheduling)
name
- the String
name of this objectscheduling
- the
SchedulingParameters
for this objectpublic RealtimeThread(java.lang.String name, SchedulingParameters scheduling, ReleaseParameters releaseParameters)
name
- the String
name of this objectscheduling
- the
SchedulingParameters
for this objectreleaseParameters
- the
ReleaseParameters
for this objectpublic RealtimeThread(java.lang.String name, SchedulingParameters scheduling, ReleaseParameters releaseParameters, MemoryParameters memoryParameters, MemoryArea memoryArea, ProcessingGroupParameters processingGroup, java.lang.Runnable logic)
name
- the String
name of this objectscheduling
- the
SchedulingParameters
for this objectreleaseParameters
- the
ReleaseParameters
for this objectmemoryParameters
- the
MemoryParameters
for this objectmemoryArea
- the
MemoryArea
for this objectprocessingGroup
- the
ProcessingGroupParameters
for this objectlogic
- the Runnable
code for this objectMethod Detail |
public abstract void body() throws java.lang.InterruptedException, ThreadTerminatedException
Thread.run()
,
but that method is used as a wrapper
RealtimeThread
to initialize, passivate and clean up this
RealtimeThread
. Must be
overridden in subclass.
java.lang.InterruptedException
- thrown if a wait()
is
interrupted
ThreadTerminatedException
- thrown if a simulation shutdown occurs
while this thread has not yet terminatedpublic void run()
run()
method of this thread.
run
in interface java.lang.Runnable
public int dynamicPriority()
public void initialize()
public java.lang.String toString()
public void exit()
public boolean addToFeasibility()
addToFeasibility
in interface Schedulable
Not currently implemented
public MemoryParameters getMemoryParameters()
getMemoryParameters
in interface Schedulable
MemoryParameters
of
this object.public ProcessingGroupParameters getProcessingGroupParameters()
getProcessingGroupParameters
in interface Schedulable
ProcessingGroupParameters
of
this object.public ReleaseParameters getReleaseParameters()
getReleaseParameters
in interface Schedulable
ReleaseParameters
of
this object.public Scheduler getScheduler()
getScheduler
in interface Schedulable
public SchedulingParameters getSchedulingParameters()
getSchedulingParameters
in interface Schedulable
public int getBasePriority()
public boolean removeFromFeasibility()
removeFromFeasibility
in interface Schedulable
Not currently implemented
public void setMemoryParameters(MemoryParameters memoryParameters)
setMemoryParameters
in interface Schedulable
memoryParameters
- public boolean setMemoryParametersIfFeasible(MemoryParameters memoryParameters)
setMemoryParametersIfFeasible
in interface Schedulable
memoryParameters
- Not currently implemented
public void setProcessingGroupParameters(ProcessingGroupParameters processingGroup)
setProcessingGroupParameters
in interface Schedulable
processingGroup
- public boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters groupParameters)
setProcessingGroupParametersIfFeasible
in interface Schedulable
groupParameters
-
Not currently implemented
public void setReleaseParameters(ReleaseParameters releaseParameters)
setReleaseParameters
in interface Schedulable
releaseParameters
- public boolean setReleaseParametersIfFeasible(ReleaseParameters releaseParameters)
setReleaseParametersIfFeasible
in interface Schedulable
releaseParameters
-
Not currently implemented
public void setScheduler(Scheduler scheduler) throws java.lang.IllegalThreadStateException
setScheduler
in interface Schedulable
scheduler
-
java.lang.IllegalStateException
java.lang.IllegalThreadStateException
public void setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters releaseParameters, MemoryParameters memoryParameters, ProcessingGroupParameters processingGroup) throws java.lang.IllegalThreadStateException
setScheduler
in interface Schedulable
scheduler
- scheduling
- releaseParameters
- memoryParameters
- processingGroup
-
IllegalThreadstateException
java.lang.IllegalThreadStateException
public void setSchedulingParameters(SchedulingParameters scheduling)
RealtimeThread
's scheduling
parameters
setSchedulingParameters
in interface Schedulable
scheduling
- The new scheduling parameterspublic boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
setSchedulingParametersIfFeasible
in interface Schedulable
scheduling
-
Not currently implemented
public boolean isActive()
RealtimeThread
is running
or scheduled to run later.
RealtimeThread
is activepublic void printResourcesHeld()
public static void printAllStatistics()
public void notifyPriorityChange(int oldPriority, int newPriority)
public double averagePriority()
public void printStatistics()
public AbsoluteTime getLastWaitStart()
public void printTimes()
public void setLastWaitStart()
public void addToWaitTime(RelativeTime time)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |