From: <jsa...@us...> - 2009-02-14 23:43:37
|
Revision: 134 http://flexotask.svn.sourceforge.net/flexotask/?rev=134&view=rev Author: jsauerbach Date: 2009-02-14 23:43:34 +0000 (Sat, 14 Feb 2009) Log Message: ----------- Change priority numbering to be more truly independent of the specific RTSJ implementation used in the VM. Modified Paths: -------------- trunk/flexotask/src/com/ibm/realtime/flexotask/scheduling/FlexotaskSchedulerRunnable.java Modified: trunk/flexotask/src/com/ibm/realtime/flexotask/scheduling/FlexotaskSchedulerRunnable.java =================================================================== --- trunk/flexotask/src/com/ibm/realtime/flexotask/scheduling/FlexotaskSchedulerRunnable.java 2009-02-14 16:13:35 UTC (rev 133) +++ trunk/flexotask/src/com/ibm/realtime/flexotask/scheduling/FlexotaskSchedulerRunnable.java 2009-02-14 23:43:34 UTC (rev 134) @@ -23,11 +23,17 @@ /** The FlexotaskTimerService to use for this Runnable */ private FlexotaskTimerService timer; - /** The priority (using the RTSJ scale of 1-28) at which this Runnable is to run */ - private int priority = 28; + /** The priority at which this Runnable is to run; a non-positive integer, with 0 representing + * the highest available (and default) priority. */ + private int priority; /** - * @return the priority at which this Runnable should run, using the RTSJ scale of 1-28 (default is 28 if never set) + * Returns the priority at which this Runnable will run, using an artificial scale in which 0 is the highest and + * default priority, and lower priorities are indicated by negative numbers. + * A non-RTSJ VM must provide at least 10 distinct levels (from 0, highest, to -9, lowest). + * An RTSJ VM must align priority 0 with PriorityScheduler.maxPriority() and (negative) priority N with + * Priority.maxPriority() + N. + * @return the requested priority */ public int getPriority() { return priority; @@ -52,14 +58,17 @@ } /** - * Set the priority at which this Runnable should run, using the RTSJ scale of 1-28 (default is 28 if never set). - * This method must be called prior to passing the Runnable to the thread factory. Otherwise, the call will have no - * effect. - * @param priority the new priority, which must be in the range 1-28 + * Sets the priority at which this Runnable will run, using an artificial scale in which 0 is the highest and + * default priority, and lower priorities are indicated by negative numbers. + * A non-RTSJ VM must provide at least 10 distinct levels (from 0, highest, to -9, lowest). Priorities lower + * that -9 are not guaranteed to be portably distinct but are accepted. + * An RTSJ VM must align priority 0 with PriorityScheduler.maxPriority() and (negative) priority N with + * Priority.maxPriority() + N. + * @param priority the new priority, which must be <= 0 */ public void setPriority(int priority) { - if (priority < 1 || priority > 28) { - throw new IllegalArgumentException("Priority must be in the range 1-28"); + if (priority > 0) { + throw new IllegalArgumentException("Priority must be <= 0"); } this.priority = priority; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |