You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Elena Sayapina (JIRA)" <ji...@apache.org> on 2007/07/04 08:26:04 UTC

[jira] Created: (HARMONY-4331) [drlvm][kernel] Setting max priority for parent group incorrectly affects child group in case parent group is system thread group

[drlvm][kernel] Setting max priority for parent group incorrectly affects child group in case parent group is system thread group
---------------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-4331
                 URL: https://issues.apache.org/jira/browse/HARMONY-4331
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Elena Sayapina
            Priority: Minor


Setting max priority for parent group incorrectly affects child group in case parent group is system thread group.

In the test below max priority of the child group firstly is set to 2 and then max priority of parent group is changed to 9.
Child group max priority shouldn't be affected by this change because 2<9, but it is if parent group is system thread group.

Please, consider the following code:

public class priorityTest {

	public static void main(String[] args) {

	    int pri1 = Thread.MIN_PRIORITY+1;
	    int pri2 = Thread.MAX_PRIORITY-1;
		
	    ThreadGroup systemgroup = Thread.currentThread().getThreadGroup();
	    ThreadGroup testgroup = new ThreadGroup("group");
	    try {
	    	testgroup.setMaxPriority(pri1);
	    	System.out.println("testgroup max priority=" + testgroup.getMaxPriority());
	    	systemgroup.setMaxPriority(pri2);
	    } catch (Exception e) {
	        e.printStackTrace();
	    }
	    if (testgroup.getMaxPriority() == pri1) System.out.println("TEST PASSED");
	    else System.out.println("TEST FAILED: max priority was changed to " + testgroup.getMaxPriority());
	    
	    ThreadGroup parentgroup = new ThreadGroup("parent");
	    ThreadGroup childgroup = new ThreadGroup("child");
	    try {
	    	childgroup.setMaxPriority(pri1);
	    	System.out.println("childgroup max priority=" + childgroup.getMaxPriority());
	    	parentgroup.setMaxPriority(pri2);
	    } catch (Exception e) {
	        e.printStackTrace();
	    }
	    if (childgroup.getMaxPriority() == pri1) System.out.println("TEST PASSED");
	    else System.out.println("TEST FAILED: max priority was changed to " + childgroup.getMaxPriority());
	}
}

Output on Harmony-r552662:

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r552662, (Jul  3 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org

testgroup max priority=2
TEST FAILED: max priority was changed to 9

childgroup max priority=2
TEST PASSED


Output on RI:
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

testgroup max priority=2
TEST PASSED

childgroup max priority=2
TEST PASSED




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.