* JobQueue: Prevet NPE at shutdown (thanks liberty)
This commit is contained in:
@ -227,10 +227,14 @@ public class JobQueue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long getMaxLag() {
|
public long getMaxLag() {
|
||||||
|
// first job is the one that has been waiting the longest
|
||||||
Job j = _readyJobs.peek();
|
Job j = _readyJobs.peek();
|
||||||
if (j == null) return 0;
|
if (j == null) return 0;
|
||||||
// first job is the one that has been waiting the longest
|
JobTiming jt = j.getTiming();
|
||||||
long startAfter = j.getTiming().getStartAfter();
|
// PoisonJob timing is null, prevent NPE at shutdown
|
||||||
|
if (jt == null)
|
||||||
|
return 0;
|
||||||
|
long startAfter = jt.getStartAfter();
|
||||||
return _context.clock().now() - startAfter;
|
return _context.clock().now() - startAfter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user