Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,22 @@ public PipeTsFileInsertionEvent(
*/
public boolean waitForTsFileClose() throws InterruptedException {
if (!isClosed.get()) {
isClosed.set(resource.isClosed());

synchronized (isClosed) {
while (!isClosed.get()) {
isClosed.wait();
isClosed.wait(100);

final boolean isClosedNow = resource.isClosed();
if (isClosedNow) {
isClosed.set(true);
isClosed.notifyAll();
break;
}
}
}
}

// From illustrations above we know If the status is "closed", then the tsFile is flushed
// And here we guarantee that the isEmpty() is set before flushing if tsFile is empty
// Then we know: "isClosed" --> tsFile flushed --> (isEmpty() <--> tsFile is empty)
Expand Down