ProcessingConstraint
.@Deprecated
public class ProcessingGroupParameters
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
cost
(budget). The
motivation for this class is to allow the execution demands of one or
more aperiodic schedulables to be bound. However, periodic or sporadic
schedulables can also be associated with a processing group.
Processing groups have an associated affinity set that must contain only a single processor.
For all schedulables with a reference to an instance of
ProcessingGroupParameters
p
no more than
p.cost
will be allocated to the execution of these
schedulables on the processor associated with its processing
group in each interval of time given by p.period
after
the time indicated by p.start
. No execution of the
schedulables will be allowed on any processor other than this
processor. When there is no intersection between the a schedulable
object's affinity set and its processing group's affinity set, then
the schedulable execution is constrained by the default
processing group's affinit set.
Logically a virtual server is associated with each instance of
ProcessingGroupParameters
. This server has a start time,
a period, a cost (budget) and a deadline. The server can only
logically execute when (a) it has not consumed more execution time in
its current release than the cost parameter, and (b) one of its
associated schedulables is executable and is the most eligible
of the executable schedulables. When the server is logically
executable, the associated schedulable is executed.
When the cost has been consumed, any overrunHandler
is
released, and the server is not eligible for logical execution until
its next period is due. At this point, its allocated cost is
replenished. When the server is logically executing when its deadline
expires, any associated missHandler
is released.
The deadline and cost parameters of all the associated schedulable
objects have the same impact as they would if the objects were not
bound to a processing group.
Processing group parameters use HighResolutionTime
values
for cost, deadline, period and start time. Since those times are
expressed as a HighResolutionTime
, the values use accurate
timers with nanosecond granularity. The actual resolution available
and even the quantity it measures depends on the clock associated
with each time value.
When a reference to a ProcessingGroupParameters
object is given as a parameter to a schedulable's constructor
or passed as an argument to one of the schedulable's setter
methods, the ProcessingGroupParameters
object becomes
the processing group parameters object bound to that schedulable
object. Changes to the values in the
ProcessingGroupParameters
object affect that schedulable
object. When bound to more than one schedulable then changes to
the values in the ProcessingGroupParameters
object
affect all of the associated objects. Note that this is a
one-to-many relationship and not a many-to-many.
The implementation must use modified copy semantics for each
HighResolutionTime
parameter value. The value of each time
object should be treated as if it were copied at the time it is
passed to the parameter object, but the object reference must also be
retained.
Only changes to a ProcessingGroupParameters
object
caused by methods on that object are immediately visible to the
scheduler. For instance, invoking setPeriod()
on a
ProcessingGroupParameters
object will make the change,
then notify the scheduler that the parameter object has changed.
At that point the scheduler's view of the processing group parameters
object is updated. Invoking a method on the
RelativeTime
object that is the period for this object
may change the period but it does not pass the change to the
scheduler at that time. That new value for period must not change
the behavior of the SOs that use the parameter object until a setter
method on the ProcessingGroupParameters
object is
invoked, or the parameter object is used in
setProcessingGroupParameters()
or a constructor for an
SO.
The implementation may use copy semantics for each
HighResolutionTime
parameter value. For instance the
value returned by getCost()
must be equal
to the value passed in by setCost
, but it need not be
the same object.
The following table gives the default parameter values for the constructors.
Attribute |
Default Value |
---|---|
start | new RelativeTime(0,0) |
period | No default. A value must be supplied |
cost | No default. A value must be supplied |
deadline | new RelativeTime(period) |
overrunHandler | None |
missHandler | None |
Caution: This class is explicitly unsafe in multithreaded situations when it is being changed. No synchronization is done. It is assumed that users of this class who are mutating instances will be doing their own synchronization at a higher level.
Caution: The cost
parameter time should be
considered to be measured against the target platform.
Constructor and Description |
---|
ProcessingGroupParameters(HighResolutionTime<?> start,
RelativeTime period,
RelativeTime cost,
RelativeTime deadline,
AsyncEventHandler overrunHandler,
AsyncEventHandler missHandler)
Deprecated.
Creates a
ProcessingGroupParameters object. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Deprecated.
Creates a clone of
this . |
RelativeTime |
getCost()
Deprecated.
Gets the value of
cost . |
AsyncEventHandler |
getCostOverrunHandler()
Deprecated.
Gets the cost overrun handler.
|
RelativeTime |
getDeadline()
Deprecated.
Gets the value of
deadline . |
AsyncEventHandler |
getDeadlineMissHandler()
Deprecated.
Gets the deadline miss handler.
|
RelativeTime |
getPeriod()
Deprecated.
Gets the value of
period . |
HighResolutionTime<?> |
getStart()
Deprecated.
Gets the value of
start . |
void |
setCost(RelativeTime cost)
Deprecated.
Sets the value of
cost . |
void |
setCostOverrunHandler(AsyncEventHandler handler)
Deprecated.
Sets the cost overrun handler.
|
void |
setDeadline(RelativeTime deadline)
Deprecated.
Sets the value of
deadline . |
void |
setDeadlineMissHandler(AsyncEventHandler handler)
Deprecated.
Sets the deadline miss handler.
|
boolean |
setIfFeasible(RelativeTime period,
RelativeTime cost,
RelativeTime deadline)
Deprecated.
This method first performs a feasibility analysis using the period,
cost and deadline attributes as replacements for the matching
attributes
this . |
void |
setPeriod(RelativeTime period)
Deprecated.
Sets the value of
period . |
void |
setStart(HighResolutionTime<?> start)
Deprecated.
Sets the value of
start . |
public ProcessingGroupParameters(HighResolutionTime<?> start, RelativeTime period, RelativeTime cost, RelativeTime deadline, AsyncEventHandler overrunHandler, AsyncEventHandler missHandler) throws java.lang.IllegalArgumentException, IllegalAssignmentError
ProcessingGroupParameters
object.start
- Time at which the first period begins. When a
RelativeTime
, this time is relative to the
creation of this
. When an AbsoluteTime
, then the
first release of the logical server is at the start time (or
immediately when the absolute time is in the past). When
null
, the default value is a new instance of
RelativeTime(0,0)
.period
- The period is the interval between successive
replenishment of the logical server's associated cost
budget. There is no default value. When period
is null
an exception is thrown.cost
- Processing time per period. The budget CPU time that
the logical server can consume each period. When
null
, an exception is thrown.deadline
- The latest permissible completion time measured
from the start of the current period. Changing the deadline
might not take effect after the expiration of the current
deadline. Specifying a deadline less than the period
constrains execution of all the members of the group to the
beginning of each period. When null
, the default
value is new instance of RelativeTime(period)
.overrunHandler
- This handler is invoked when any schedulable
object member of this processing group attempts to use
processor time beyond the group's budget. When
null
, no application async event handler is
fired on the overrun condition.missHandler
- This handler is invoked when the logical server is
still executing after the deadline has passed. When
null
, no application async event handler is
fired on the deadline miss condition.java.lang.IllegalArgumentException
- when the period
is null
or its time value is not greater than
zero, when cost
is null
, or when the
time value of cost
is less than zero, when
start
is an instance of
RelativeTime
and its value is negative, or when
the time value of deadline
is not greater than
zero and less than or equal to the period
. When
the implementation does not support processing group
deadline less than period, deadline
less than
period
will cause
IllegalArgumentException
to be thrown.IllegalAssignmentError
- when
start
,
period
,
cost
,
deadline
,
overrunHandler
or
missHandler
cannot be stored in this
.public java.lang.Object clone()
this
. This method should behave
effectively as if it constructed a new object with clones of the
high-resolution time values of this
.
clone
does not copy any associations from
this
and it does not implicitly bind the new object to a SO.
clone
in class java.lang.Object
this
public RelativeTime getCost()
cost
.cost
.public AsyncEventHandler getCostOverrunHandler()
AsyncEventHandler
that
is cost overrun handler of this
.public RelativeTime getDeadline()
deadline
.RelativeTime
that is
the deadline of this
.public AsyncEventHandler getDeadlineMissHandler()
AsyncEventHandler
that
is deadline miss handler of this
.public RelativeTime getPeriod()
period
.RelativeTime
that
represents the value of period
.public HighResolutionTime<?> getStart()
start
. This is the value that
was specified in the constructor or by setStart()
,
not the actual absolute time the corresponding to the start of the
processing group.HighResolutionTime
that represents the value of start
.public void setCost(RelativeTime cost) throws java.lang.IllegalArgumentException, IllegalAssignmentError
cost
.cost
- The new value for cost
. When
null
, an exception is thrown.java.lang.IllegalArgumentException
- when cost
is
null
or its time value is less than zero.IllegalAssignmentError
- when cost
cannot be stored in this
.public void setCostOverrunHandler(AsyncEventHandler handler) throws IllegalAssignmentError
handler
- This handler is invoked when the run()
method of and of the the schedulables attempt to
execute for more than cost
time units in any
period. When null
, no handler is attached, and
any previous handler is removed.IllegalAssignmentError
- when handler
cannot be stored in this
.public void setDeadline(RelativeTime deadline) throws java.lang.IllegalArgumentException, IllegalAssignmentError
deadline
.deadline
- The new value for deadline
. When
null
, the default value is new instance of
RelativeTime(period)
.java.lang.IllegalArgumentException
- when deadline
has a value less than zero or greater than the period.
Unless the implementation supports deadline less than
period in processing groups,
IllegalArgumentException
is also when
deadline
is less than the period.IllegalAssignmentError
- when deadline
cannot be stored in this
.public void setDeadlineMissHandler(AsyncEventHandler handler) throws IllegalAssignmentError
handler
- This handler is invoked when the run()
method of any of the schedulables still expect to
execute after the deadline has passed. When
null
, no handler is attached, and any previous
handler is removed.IllegalAssignmentError
- when handler
cannot be stored in this
.public boolean setIfFeasible(RelativeTime period, RelativeTime cost, RelativeTime deadline) throws java.lang.IllegalArgumentException, IllegalAssignmentError
this
. When the resulting system is feasible
the method replaces the current attributes of this with the new
attributes.period
- The proposed period. There is no default value. When
period
is null
an exception is
thrown.cost
- The proposed cost. When null
, an exception
is thrown.deadline
- The proposed deadline. When null
, the
default value is new instance of RelativeTime(period)
.true
, when the resulting system is feasible and
the changes are made. False
, when the resulting system is
not feasible and no changes are made.java.lang.IllegalArgumentException
- when the period
is null
or its time value is not greater than
zero, or when the time value of cost
is less
than zero, or when the time value of deadline
is
not greater than zero.IllegalAssignmentError
- when
period
,
cost
, or
deadline
cannot be stored in this
.public void setPeriod(RelativeTime period) throws java.lang.IllegalArgumentException, IllegalAssignmentError
period
.period
- The new value for period
. There is no
default value. When period
is null
an exception is thrown.java.lang.IllegalArgumentException
- when period
is
null
, or its time value is not greater than zero.
When the implementation does not support processing group
deadline less than period, and period
is not
equal to the current value of the processing group's deadline,
the deadline is set to a clone of period
created
in the same memory area as period
.IllegalAssignmentError
- when period
cannot be stored in this
.public void setStart(HighResolutionTime<?> start) throws java.lang.IllegalArgumentException, IllegalAssignmentError
start
. When the processing group is
already started this method alters the value of this object's start
time property, but has no other effect.start
- The new value for start
. When
null
, the default value is a new instance of
RelativeTime(0,0)
.IllegalAssignmentError
- when start
cannot be stored in this
.java.lang.IllegalArgumentException
- when start
is a
relative time value and less than zero.