|
|
@ -36,36 +36,40 @@ public class ArbitraryDataBuilderThread implements Runnable { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Map.Entry<String, ArbitraryDataBuildQueueItem> next = null; |
|
|
|
Long now = NTP.getTime(); |
|
|
|
|
|
|
|
if (now == null) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArbitraryDataBuildQueueItem queueItem = null; |
|
|
|
|
|
|
|
|
|
|
|
// Find resources that are queued for building
|
|
|
|
// Find resources that are queued for building
|
|
|
|
synchronized (buildManager.arbitraryDataBuildQueue) { |
|
|
|
synchronized (buildManager.arbitraryDataBuildQueue) { |
|
|
|
next = buildManager.arbitraryDataBuildQueue |
|
|
|
Map.Entry<String, ArbitraryDataBuildQueueItem> next = buildManager.arbitraryDataBuildQueue |
|
|
|
.entrySet().stream() |
|
|
|
.entrySet().stream() |
|
|
|
.filter(e -> e.getValue().isQueued()) |
|
|
|
.filter(e -> e.getValue().isQueued()) |
|
|
|
.findFirst().orElse(null); |
|
|
|
.findFirst().orElse(null); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (next == null) { |
|
|
|
if (next == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Long now = NTP.getTime(); |
|
|
|
queueItem = next.getValue(); |
|
|
|
if (now == null) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArbitraryDataBuildQueueItem queueItem = next.getValue(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (queueItem == null) { |
|
|
|
if (queueItem == null) { |
|
|
|
this.removeFromQueue(queueItem); |
|
|
|
this.removeFromQueue(queueItem); |
|
|
|
|
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Ignore builds that have failed recently
|
|
|
|
// Ignore builds that have failed recently
|
|
|
|
if (buildManager.isInFailedBuildsList(queueItem)) { |
|
|
|
if (buildManager.isInFailedBuildsList(queueItem)) { |
|
|
|
|
|
|
|
this.removeFromQueue(queueItem); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set the start timestamp, to prevent other threads from building it at the same time
|
|
|
|
|
|
|
|
queueItem.prepareForBuild(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
// Perform the build
|
|
|
|
// Perform the build
|
|
|
|