提交 42d46cab 编写于 作者: K kohsuke

avoid negative value

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16360 71c3de6d-444a-0410-be80-ed276b4c234a
上级 cb73edc1
...@@ -80,7 +80,7 @@ public abstract class PeriodicWork extends SafeTimerTask implements ExtensionPoi ...@@ -80,7 +80,7 @@ public abstract class PeriodicWork extends SafeTimerTask implements ExtensionPoi
* By default it chooses the value randomly between 0 and {@link #getRecurrencePeriod()} * By default it chooses the value randomly between 0 and {@link #getRecurrencePeriod()}
*/ */
public long getInitialDelay() { public long getInitialDelay() {
return new Random().nextLong()%getRecurrencePeriod(); return Math.abs(new Random().nextLong())%getRecurrencePeriod();
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册