|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.realtime.DSS.Resource
Super class for all unit resources, i.e., object contended for by
Field Summary | |
protected RelativeTime |
busyTimeThusFar
|
protected int |
count
The re-entrancy count of this Resource ;
zero when not held by any
RealtimeThread ; |
protected AbsoluteTime |
creationTime
|
RealtimeThread |
holderThread
The current holder of this Resource ;
if null , the resource is not currently held. |
protected AbsoluteTime |
lastGrant
|
protected AbsoluteTime |
lastRelease
|
java.lang.String |
name
The name of this Resource . |
protected boolean |
signalPriorityInversion
|
protected WaiterSet |
waiters
The waiter set of this resource, used to implement the scheduling policy of this resource. |
Constructor Summary | |
Resource(java.lang.String name,
boolean signalPriorityInversion)
Constructor |
Method Summary | |
abstract void |
adjustPriority(RealtimeThread thread)
Adjust the priority of this RealtimeThread , according to resources currently held. |
double |
dutyCycle()
|
void |
finalize()
|
static java.util.Set |
getExtent()
To support backtracking |
protected void |
giveResourceTo(RealtimeThread thread)
Give this Resource to the given
thread. |
int |
maxWaiterPriority()
Test whether this resource is currently experiencing priority inversion, i.e., is held by a RealtimeThread
with a priority later than that of a waiting thread. |
static void |
printAllStatistics()
|
void |
printStatistics()
|
abstract void |
release()
Release this resource. |
void |
releaseIfHeld()
Release this Resource if held. |
abstract void |
seize()
Seize this resource, waiting if necessary. |
void |
seize(Resource second)
Conjunctive seize, i.e., seize both this and the given resource. |
void |
seizeIfNotHeld()
Seize this Resource if not already held. |
static void |
setExtent(java.util.Set newExtent)
|
java.lang.String |
toString()
Construct a printable representation of this Resource |
java.util.Iterator |
waiterIterator()
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public java.lang.String name
Resource
.
protected AbsoluteTime creationTime
protected AbsoluteTime lastGrant
protected AbsoluteTime lastRelease
protected RelativeTime busyTimeThusFar
public RealtimeThread holderThread
Resource
;
if null
, the resource is not currently held.
protected int count
Resource
;
zero when not held by any
RealtimeThread
;
protected boolean signalPriorityInversion
protected WaiterSet waiters
Constructor Detail |
public Resource(java.lang.String name, boolean signalPriorityInversion)
name
- the name of this resourceMethod Detail |
public void finalize()
public abstract void seize() throws java.lang.InterruptedException, ThreadTerminatedException
java.lang.InterruptedException
ThreadTerminatedException
public void seize(Resource second) throws java.lang.InterruptedException, ThreadTerminatedException
second
- The second Resource
to seize, in addition to this Resource
java.lang.InterruptedException
- Thrown if the seizing
RealtimeThread
is shut down while waiting for a
Resource
ThreadTerminatedException
public void seizeIfNotHeld() throws java.lang.InterruptedException, ThreadTerminatedException
Resource
if not already held.
This method can be useful after hold
method calls where it is
unknown upon return whether the resource is still held or was stolen away,
e.g., by a higher priority thread.
java.lang.InterruptedException
ThreadTerminatedException
public abstract void release() throws ThreadTerminatedException
ThreadTerminatedException
public void releaseIfHeld() throws ThreadTerminatedException
Resource
if held.
This method can be useful after hold
method calls where it is
unknown upon return whether the resource is still held or was stolen away,
e.g., by a higher priority thread.
ThreadTerminatedException
protected void giveResourceTo(RealtimeThread thread) throws ThreadTerminatedException
Resource
to the given
thread. This maintains all the resource possession invariants on the new
thread and the holder thread, each of which may be null
, indicating
that the resource is not held by any thread.
Implementation note: this method must be called by seize
and
release
methods in subclasses, in order for resource utilization
statistics to be properly logged.
thread
- the thread to be given the
Resource
; may be null
ThreadTerminatedException
public java.util.Iterator waiterIterator()
public double dutyCycle()
public abstract void adjustPriority(RealtimeThread thread)
RealtimeThread
, according to resources currently held.
public java.lang.String toString()
Resource
public int maxWaiterPriority()
RealtimeThread
with a priority later than that of a waiting thread.
public static void printAllStatistics()
public void printStatistics()
public static java.util.Set getExtent()
public static void setExtent(java.util.Set newExtent)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |