Name: akC45999 Date: 10/30/97
Using setMaxPriority() method, user can decrease group priority,
but cannot increase it, even to the previous value.
Such behaviour contradicts the specification.
------------------------------------- file setMaxPriority0102.java
// simplified version of the test
// javasoft.sqe.tests.api.java.lang.ThreadGroup.setMaxPriority0102;
import java.io.PrintStream;
public class setMaxPriority0102 {
public static void main(String args[]) {
ThreadGroup group=new ThreadGroup("setMaxPriority0102");
for (int prio=Thread.MIN_PRIORITY; prio<=Thread.MAX_PRIORITY; prio++) {
try {
group.setMaxPriority(prio);
} catch (Throwable e) {
System.out.println("unexpected exception in setMaxPriority("+prio+"):"+e);
return;
}
int prio1;
try {
prio1=group.getMaxPriority();
} catch (Throwable e) {
System.out.println("unexpected exception in setMaxPriority("+prio+"):"+e);
return;
}
if (prio1!=prio) {
System.out.println("setMaxPriority("+prio+"); getMaxPriority()="+prio1);
return;
}
}
}
} // end class setMaxPriority0102
------------------------------------- end of file setMaxPriority0102.java
Running the test:
novo64% javac setMaxPriority0102.java
novo64% setenv CLASSPATH .
novo64% java setMaxPriority0102
setMaxPriority(2); getMaxPriority()=1
novo64%
======================================================================