I agree that the code seems like ot should return. But it doesn't. Here's a test to prove it. The test runs forever.

The method under test is copied from the real Jenkins class. I just remove the Jenkins singleton stuff to make it simpler, but I think it should not change anything.

package jenkins.model;

import java.io.IOException;

import org.junit.Test;

public class JenkinsTest {
    private transient volatile boolean isQuietingDown = false;

    public void doQuietDown(boolean block,int timeout) throws InterruptedException, IOException {
        synchronized (this) {
            isQuietingDown  = true;
        }
        if (block) {
            if (timeout > 0) {
                timeout += System.currentTimeMillis();
            }
            while (isQuietingDown
                   && (timeout <= 0 || System.currentTimeMillis() < timeout)
                   && true) {
                System.out.println("time: " + System.currentTimeMillis() + " Sleeping ...");
                Thread.sleep(1000);
            }
        }
        System.out.println("doQuietDown returning");
    }
    @Test
    public void testDoQuietDownBooleanInt() throws Exception {
        doQuietDown(true, 100);
    }
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to