Skip to content

Commit

Permalink
Remove debug code, cosmetic logging fixes (#39480)
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova authored Mar 29, 2024
1 parent c2f8321 commit 0d03809
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,7 @@ static final class WindowWork<T> {
private static final String PENDING_KEY = "pending";
public static final String SIGNAL_TYPE_KEY = "signalType";
public static final String EMIT_RESULT_KEY = "emitResult";
private static final String TERMINATING_SUCCEEDED_WORK = "Terminating the work.";
private static final String TERMINATING_WORK = "Terminating the work. {}";
private static final String TERMINATING_WORK = "Terminating the work.";

private final AtomicBoolean isInitialized = new AtomicBoolean(false);
private final AtomicBoolean isCanceled = new AtomicBoolean(false);
Expand Down Expand Up @@ -697,17 +696,7 @@ private boolean init() {
if (isInitialized.getAndSet(true)) {
return false;
}
try {
this.timers.add(beginTimeoutTimer());
} catch (RuntimeException ex) {
logger.atError().log("!!!!!!!!!!!!!!!!!!!!!", ex);
Throwable e = ex;
while (e.getCause() != null) {
e = ex.getCause();
logger.atError().log("!!!!!!!!!!!!!!!!!!!!!", e);
}
throw ex;
}
this.timers.add(beginTimeoutTimer());
this.timers.add(beginNextItemTimeoutTimer());
return true;
}
Expand Down Expand Up @@ -801,19 +790,23 @@ private void terminate(WorkTerminalState terminalState) {
timers.dispose();
} finally {
if (terminalState == WorkTerminalState.SINK_ERROR) {
withPendingKey(logger.atWarning()).log(TERMINATING_WORK, "(Reason: sink-error)");
withPendingKey(logger.atWarning())
.addKeyValue("reason", "sink-error")
.log(TERMINATING_WORK);
return;
}

if (terminalState == WorkTerminalState.CANCELED) {
assertCondition(isCanceled(), terminalState);
withPendingKey(logger.atWarning()).log(TERMINATING_WORK, "(Reason: sink-canceled)");
withPendingKey(logger.atWarning())
.addKeyValue("reason", "sink-canceled")
.log(TERMINATING_WORK);
return;
}

if (terminalState == WorkTerminalState.RECEIVED_DEMANDED) {
assertCondition(hasReceivedDemanded(), terminalState);
withPendingKey(logger.atVerbose()).log(TERMINATING_SUCCEEDED_WORK);
withPendingKey(logger.atVerbose()).log(TERMINATING_WORK);
closeWindow();
return;
}
Expand All @@ -831,10 +824,14 @@ private void terminate(WorkTerminalState terminalState) {
final TimeoutReason reason = timeoutReason.get();
final Throwable e = reason.getError();
if (e != null) {
withPendingKey(logger.atWarning()).log(TERMINATING_WORK, reason.getMessage(), e);
withPendingKey(logger.atWarning())
.addKeyValue("reason", reason.getMessage())
.log(TERMINATING_WORK, e);
closeWindow(e);
} else {
withPendingKey(logger.atVerbose()).log(TERMINATING_WORK, reason.getMessage());
withPendingKey(logger.atVerbose())
.addKeyValue("reason", reason.getMessage())
.log(TERMINATING_WORK);
closeWindow();
}
return;
Expand All @@ -850,7 +847,9 @@ private void terminate(WorkTerminalState terminalState) {

if (terminalState == WorkTerminalState.PARENT_TERMINAL_CLEAN_CLOSE) {
assertCondition(parent.isDoneOrCanceled() && isStreaming(), terminalState);
withPendingKey(logger.atWarning()).log(TERMINATING_WORK, "(Reason: terminal-clean-close)");
withPendingKey(logger.atWarning())
.addKeyValue("reason", "terminal-clean-close")
.log(TERMINATING_WORK);
closeWindow();
return;
}
Expand Down

0 comments on commit 0d03809

Please sign in to comment.