flag calc
This commit is contained in:
parent
4e6ab1a862
commit
0f04ab3e42
1 changed files with 12 additions and 8 deletions
|
|
@ -138,24 +138,20 @@ public final class XmlMergeCoordinator implements IPipeLineTerminator<PartFilePa
|
||||||
}
|
}
|
||||||
batch.add(part);
|
batch.add(part);
|
||||||
// добираем до batchSize, но не ждём бесконечно
|
// добираем до batchSize, но не ждём бесконечно
|
||||||
//todo подозрительное действие, прочекать не будет ли мешать poison
|
|
||||||
while (batch.size() < batchSize) {
|
while (batch.size() < batchSize) {
|
||||||
PartFilePayload p = inQueue.poll(1000, TimeUnit.MILLISECONDS);
|
PartFilePayload p = inQueue.poll(1, TimeUnit.SECONDS);
|
||||||
if (p == null) {
|
if (p == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (p.isPoison()) {
|
if (p.isPoison()) {
|
||||||
|
merge(batch);
|
||||||
done.complete(new SignalXmlFilePayload(out));
|
done.complete(new SignalXmlFilePayload(out));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
batch.add(p);
|
batch.add(p);
|
||||||
}
|
}
|
||||||
if (!batch.isEmpty()) {
|
if (!batch.isEmpty()) {
|
||||||
log.debug("Starting merge batch; size: {}", batch.size());
|
merge(batch);
|
||||||
mergeBatch(batch);
|
|
||||||
// удаляем исходники после успешного мерджа
|
|
||||||
for (PartFilePayload p : batch) Files.deleteIfExists(p.getPartPath());
|
|
||||||
batch.clear();
|
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
|
|
@ -165,4 +161,12 @@ public final class XmlMergeCoordinator implements IPipeLineTerminator<PartFilePa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void merge(List<PartFilePayload> inputs) throws Exception {
|
||||||
|
log.debug("Starting merge batch; size: {}", inputs.size());
|
||||||
|
mergeBatch(inputs);
|
||||||
|
//удаляем исходники после успешного мерджа
|
||||||
|
for (PartFilePayload p : inputs) Files.deleteIfExists(p.getPartPath());
|
||||||
|
inputs.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue