|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--javax.realtime.RealtimeThread
RealtimeThread
extends 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 Thread
(e.g., enumerate and join) complete normally
except where such execution would 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
.
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
RealtimeThread()
Create a real-time thread. |
|
RealtimeThread(SchedulingParameters scheduling)
Create a real-time thread with the given SchedulingParameters . |
|
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters release)
Create a real-time thread with the given SchedulingParameters and ReleaseParameters . |
|
RealtimeThread(SchedulingParameters scheduling,
ReleaseParameters release,
MemoryParameters memory,
MemoryArea area,
ProcessingGroupParameters group,
java.lang.Runnable logic)
Create a real-time thread with the given characteristics and a Runnable . |
Method Summary | |
boolean |
addIfFeasible()
Add to the feasibility of the already set scheduler if the resulting feasibility set is schedulable. |
boolean |
addToFeasibility()
Inform the scheduler and cooperating facilities that the resource demands (as expressed in the associated instances of SchedulingParameters ,
ReleaseParameters ,
MemoryParameters , and
ProcessingGroupParameters )
of this instance of Schedulable
will be considered in the feasibility analysis of the
associated Scheduler until further notice. |
static RealtimeThread |
currentRealtimeThread()
This will throw a ClassCastException if the current thread is not a
RealtimeThread . |
void |
deschedulePeriodic()
Stop unblocking waitForNextPeriod() for a periodic schedulable object. |
static MemoryArea |
getCurrentMemoryArea()
Return the instance of MemoryArea which is the current memory area for this. |
static int |
getInitialMemoryAreaIndex()
Memory area stacks include inherited stacks from parent threads. |
static int |
getMemoryAreaStackDepth()
Get the size of the stack of MemoryArea instances to
which this RealtimeThread has access. |
MemoryParameters |
getMemoryParameters()
Return a reference to the MemoryParameters object. |
static MemoryArea |
getOuterMemoryArea(int index)
Get the instance of MemoryArea in the memory area stack
at the index given. |
ProcessingGroupParameters |
getProcessingGroupParameters()
Return a reference to the ProcessingGroupParameters object. |
ReleaseParameters |
getReleaseParameters()
Returns a reference to the ReleaseParameters object. |
Scheduler |
getScheduler()
Get the scheduler for this thread. |
SchedulingParameters |
getSchedulingParameters()
Return a reference to the SchedulingParameters object. |
void |
interrupt()
Throw the generic AsynchronouslyInterruptedException at this. |
boolean |
removeFromFeasibility()
Inform the scheduler and cooperating facilities that the resource demands, as expressed in the associated instances of SchedulingParameters ,
ReleaseParameters ,
MemoryParameters , and
ProcessingGroupParameters ,
of this instance of Schedulable
should no longer be considered in the feasibility analysis of the
associated Scheduler . |
void |
schedulePeriodic()
Begin unblocking waitForNextPeriod() for a periodic thread. |
boolean |
setIfFeasible(ReleaseParameters release,
MemoryParameters memory)
Returns true if, after considering the values of the parameters, the task set would still be feasible. |
boolean |
setIfFeasible(ReleaseParameters release,
MemoryParameters memory,
ProcessingGroupParameters group)
Returns true if, after considering the values of the parameters, the task set would still be feasible. |
boolean |
setIfFeasible(ReleaseParameters release,
ProcessingGroupParameters group)
Returns true if, after considering the values of the parameters, the task set would still be feasible. |
void |
setMemoryParameters(MemoryParameters parameters)
Set the reference to the MemoryParameters object. |
boolean |
setMemoryParametersIfFeasible(MemoryParameters memParam)
Returns true if, after considering the value of the parameter, the task set would still be feasible. |
void |
setProcessingGroupParameters(ProcessingGroupParameters parameters)
Set the reference to the ProcessingGroupParameters object. |
boolean |
setProcessingGroupParametersIfFeasible(ProcessingGroupParameters groupParameters)
Returns true if, after considering the value of the parameter, the task set would still be feasible. |
void |
setReleaseParameters(ReleaseParameters parameters)
Set the reference to the ReleaseParameters object. |
boolean |
setReleaseParametersIfFeasible(ReleaseParameters release)
Returns true if, after considering the value of the parameter, the task set would still be feasible. |
void |
setScheduler(Scheduler scheduler)
Set the scheduler. |
void |
setScheduler(Scheduler scheduler,
SchedulingParameters scheduling,
ReleaseParameters release,
MemoryParameters memoryParameters,
ProcessingGroupParameters processingGroup)
Set the scheduler. |
void |
setSchedulingParameters(SchedulingParameters scheduling)
Set the reference to the SchedulingParameters object. |
boolean |
setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
Returns true if, after considering the value of the parameter, the task set would still be feasible. |
static void |
sleep(Clock clock,
HighResolutionTime time)
An accurate timer with nanosecond granularity. |
static void |
sleep(HighResolutionTime time)
An accurate timer with nanosecond granularity. |
void |
start()
Checks if the instance of RealtimeThread is startable and starts it
if it is. |
boolean |
waitForNextPeriod()
Used by threads that have a reference to a ReleaseParameters
type of PeriodicParameters
to block until the start of each period. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.lang.Runnable |
run |
Constructor Detail |
public RealtimeThread()
public RealtimeThread(SchedulingParameters scheduling)
SchedulingParameters
.scheduling
- The SchedulingParameters
associated with this (and possibly other RealtimeThread
).public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters release)
SchedulingParameters
and ReleaseParameters
.scheduling
- The SchedulingParameters
associated with this (and possibly other instances of
RealtimeThread
).release
- The ReleaseParameters
associated with this (and possibly other instances of
RealtimeThread
).public RealtimeThread(SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memory, MemoryArea area, ProcessingGroupParameters group, java.lang.Runnable logic)
Runnable
.scheduling
- The SchedulingParameters
associated with this (and possibly other instances of
RealtimeThread
).release
- The ReleaseParameters
associated with this (and possibly other instances of
RealtimeThread
).memory
- The MemoryParameters
associated with this (and possibly other instances of
RealtimeThread
).area
- The MemoryArea
associated with this.group
- The ProcessingGroupParameters
associated with this
(and possibly other instances of RealtimeThread
).Method Detail |
public boolean addToFeasibility()
SchedulingParameters
,
ReleaseParameters
,
MemoryParameters
, and
ProcessingGroupParameters
)
of this instance of Schedulable
will be considered in the feasibility analysis of the
associated Scheduler
until further notice.
Whether the resulting system is feasible or not, the addition is completed.addToFeasibility
in interface Schedulable
public static RealtimeThread currentRealtimeThread() throws java.lang.ClassCastException
ClassCastException
if the current thread is not a
RealtimeThread
.public void deschedulePeriodic()
waitForNextPeriod()
for a periodic schedulable object.
If this does not have a type of PeriodicParameters
as it ReleaseParameters
nothing happens.public MemoryParameters getMemoryParameters()
MemoryParameters
object.getMemoryParameters
in interface Schedulable
public ProcessingGroupParameters getProcessingGroupParameters()
ProcessingGroupParameters
object.getProcessingGroupParameters
in interface Schedulable
public ReleaseParameters getReleaseParameters()
ReleaseParameters
object.getReleaseParameters
in interface Schedulable
public Scheduler getScheduler()
getScheduler
in interface Schedulable
public SchedulingParameters getSchedulingParameters()
SchedulingParameters
object.getSchedulingParameters
in interface Schedulable
public void interrupt()
AsynchronouslyInterruptedException
at this.interrupt
in class java.lang.Thread
public boolean removeFromFeasibility()
SchedulingParameters
,
ReleaseParameters
,
MemoryParameters
, and
ProcessingGroupParameters
,
of this instance of Schedulable
should no longer be considered in the feasibility analysis of the
associated Scheduler
.
Whether the resulting system is feasible or not, the subtraction is completed.removeFromFeasibility
in interface Schedulable
public void schedulePeriodic()
waitForNextPeriod()
for a periodic thread.
Typically used when a periodic schedulable object is in an overrun condition.
The scheduler should recompute the schedule and perform admission
control.
If this does not have a type of PeriodicParameters
as it ReleaseParameters
nothing happens.public void setMemoryParameters(MemoryParameters parameters) throws java.lang.IllegalThreadStateException
MemoryParameters
object.setMemoryParameters
in interface Schedulable
javax.realtime.Schedulable
memory
- The MemoryParameters
object.public void setProcessingGroupParameters(ProcessingGroupParameters parameters)
ProcessingGroupParameters
object.setProcessingGroupParameters
in interface Schedulable
javax.realtime.Schedulable
groupParameters
- The ProcessingGroupParameters
object.public void setReleaseParameters(ReleaseParameters parameters) throws java.lang.IllegalThreadStateException
ReleaseParameters
object.setReleaseParameters
in interface Schedulable
javax.realtime.Schedulable
release
- The ReleaseParameters
object.public void setScheduler(Scheduler scheduler, SchedulingParameters scheduling, ReleaseParameters release, MemoryParameters memoryParameters, ProcessingGroupParameters processingGroup) throws java.lang.IllegalThreadStateException
setScheduler
in interface Schedulable
java.lang.IllegalThreadStateException
- Thrown when
((Thread.isAlive() && Not Blocked) == true).
(Where blocked means waiting in
Thread.wait(), Thread.join(),
or Thread.sleep()
)public void setScheduler(Scheduler scheduler) throws java.lang.IllegalThreadStateException
setScheduler
in interface Schedulable
java.lang.IllegalThreadStateException
- Thrown when
((Thread.isAlive() && Not Blocked) == true).
(Where blocked means waiting in
Thread.wait(), Thread.join(),
or Thread.sleep()
)public void setSchedulingParameters(SchedulingParameters scheduling) throws java.lang.IllegalThreadStateException
SchedulingParameters
object.setSchedulingParameters
in interface Schedulable
javax.realtime.Schedulable
scheduling
- The SchedulingParameters
object.public static void sleep(Clock clock, HighResolutionTime time) throws java.lang.InterruptedException
Clock
.
The sleep time may be relative or absolute. If relative, then the
calling thread is blocked for the amount of time given by the parameter.
If absolute, then the calling thread is blocked until the indicated
point in time. If the given absolute time is before the current time,
the call to sleep returns immediately.public static void sleep(HighResolutionTime time) throws java.lang.InterruptedException
Clock
.
The sleep time may be relative or absolute. If relative, then the
calling thread is blocked for the amount of time given by the parameter.
If absolute, then the calling thread is blocked until the indicated
point in time. If the given absolute time is before the current time,
the call to sleep returns immediately.public boolean setIfFeasible(ReleaseParameters release, MemoryParameters memory, ProcessingGroupParameters group)
public boolean setIfFeasible(ReleaseParameters release, ProcessingGroupParameters group)
public boolean setIfFeasible(ReleaseParameters release, MemoryParameters memory)
public boolean addIfFeasible()
public boolean waitForNextPeriod() throws java.lang.IllegalThreadStateException
ReleaseParameters
type of PeriodicParameters
to block until the start of each period. Periods start at either
the start time in PeriodicParameters
or when this.start()
is called. This
method will block until the start of the next period unless the thread
is in either an overrun or deadline miss condition.
If both overrun and miss handlers are null and the thread has overrun its cost or
missed a deadline waitForNextPeriod()
will immediately
return false once per overrun or deadline miss. It will then again block until
the start of the next period
(unless, of course, the thread has overrun or missed again).
If either the overrun or deadline miss handlers are not null
and the thread is in either an overrun or deadline miss condition
waitForNextPeriod()
will block until the handler
corrects the situation (possibly by calling schedulePeriodic()
).
waitForNextPeriod()
throws IllegalThreadStateException
if
this does not have a reference to a ReleaseParameters
type of PeriodicParameters
.public static MemoryArea getCurrentMemoryArea()
MemoryArea
which is the current memory area for this.public void start()
RealtimeThread
is startable and starts it
if it is.start
in class java.lang.Thread
public boolean setProcessingGroupParametersIfFeasible(ProcessingGroupParameters groupParameters)
setProcessingGroupParametersIfFeasible
in interface Schedulable
javax.realtime.Schedulable
groupParameters
- The ProcessingGroupParameters
object.public boolean setSchedulingParametersIfFeasible(SchedulingParameters scheduling)
setSchedulingParametersIfFeasible
in interface Schedulable
javax.realtime.Schedulable
scheduling
- The SchedulingParameters
object. If null nothing happens.public boolean setReleaseParametersIfFeasible(ReleaseParameters release)
setReleaseParametersIfFeasible
in interface Schedulable
javax.realtime.Schedulable
release
- The ReleaseParameters
object. If null nothing happens.public boolean setMemoryParametersIfFeasible(MemoryParameters memParam)
setMemoryParametersIfFeasible
in interface Schedulable
javax.realtime.Schedulable
memory
- The MemoryParameters
object. If null nothing happens.public static int getMemoryAreaStackDepth()
MemoryArea
instances to
which this RealtimeThread
has access.MemoryArea
instances.public static MemoryArea getOuterMemoryArea(int index)
MemoryArea
in the memory area stack
at the index given. If the given index does not exist in the
memory area scope stack then null is returned.index
- The offset into the memory area stack.MemoryArea
at index or null
if the given value is does not correspond to a position
in the stack.public static int getInitialMemoryAreaIndex()
RealtimeThread
is the memory area given as a parameter to
the constructor. This method returns the position in the memory area
stack of that initial memory area.RealtimeThread
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |