Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4089706

java.lang.ThreadGroup.setMaxPriority() does not increase priority.

XMLWordPrintable

    • sparc
    • solaris_2.4



      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%

      ======================================================================

            jjb Josh Bloch
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: