Skip to content
Open
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 @@ -20,6 +20,7 @@
import com.google.cloud.tools.jib.event.progress.ThrottledAccumulatingConsumer;
import com.google.common.base.Preconditions;
import java.io.Closeable;
import java.util.Objects;
import javax.annotation.Nullable;

/**
Expand All @@ -45,16 +46,21 @@ class ThrottledProgressEventDispatcherWrapper implements Closeable {
}

public void dispatchProgress(Long progressUnits) {
Preconditions.checkNotNull(throttledDispatcher);
Objects.requireNonNull(throttledDispatcher);
throttledDispatcher.accept(progressUnits);
}

@Override
public void close() {
Preconditions.checkNotNull(progressEventDispatcher);
Preconditions.checkNotNull(throttledDispatcher);
throttledDispatcher.close();
progressEventDispatcher.close();
try {
if (throttledDispatcher != null) {
throttledDispatcher.close();
}
} finally {
if (progressEventDispatcher != null) {
progressEventDispatcher.close();
}
}
}

void setProgressTarget(long allocationUnits) {
Expand Down
Loading