Skip to content
Permalink
Browse files

[FIXED JENKINS-31614] Avoid acquiring the Queue lock while holding ot…

…her locks.

Originally-Committed-As: c89a054375f4e58947e9926d0be74abc5174a478
  • Loading branch information
jglick committed Jan 5, 2016
1 parent 757b7e2 commit ff9a05c281a59f456052184f063ab09fc119167a
@@ -38,15 +38,19 @@
* @author Kohsuke Kawaguchi
*/
public abstract class TryRepeatedly<V> extends AbstractFuture<V> {
private final int seconds;
private final int delay;
private ScheduledFuture<?> next;

protected TryRepeatedly(int seconds) {
this.seconds = seconds;
tryLater();
protected TryRepeatedly(int delay) {
this(delay, delay);
}

private void tryLater() {
protected TryRepeatedly(int delay, int initialDelay) {
this.delay = delay;
tryLater(initialDelay);
}

private void tryLater(int currentDelay) {
// TODO log a warning if trying for too long; probably Pickle.rehydrate should be given a TaskListener to note progress

if (isCancelled()) return;
@@ -57,14 +61,14 @@ public void run() {
try {
V v = tryResolve();
if (v == null)
tryLater();
tryLater(delay);
else
set(v);
} catch (Throwable t) {
setException(t);
}
}
}, seconds, TimeUnit.SECONDS);
}, currentDelay, TimeUnit.SECONDS);
}

@Override

0 comments on commit ff9a05c

Please sign in to comment.
You can’t perform that action at this time.