8000 fix: restore thread's original name · smsilva/java-operator-sdk@40c21b2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 40c21b2

Browse files
committed
fix: restore thread's original name
This probably isn't needed but it's nicer to clean after yourself :)
1 parent 235169c commit 40c21b2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/DefaultEventHandler.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,17 @@ private ControllerExecution(ExecutionScope<R> executionScope) {
360360
@Override
361361
public void run() {
362362
// change thread name for easier debugging
363-
Thread.currentThread().setName("EventHandler-" + controllerName);
364-
PostExecutionControl<R> postExecutionControl =
365-
eventDispatcher.handleExecution(executionScope);
366-
eventProcessingFinished(executionScope, postExecutionControl);
363+
final var thread = Thread.currentThread();
364+
final var name = thread.getName();
365+
try {
366+
thread.setName("EventHandler-" + controllerName);
367+
PostExecutionControl<R> postExecutionControl =
368+
eventDispatcher.handleExecution(executionScope);
369+
eventProcessingFinished(executionScope, postExecutionControl);
370+
} finally {
371+
// restore original name
372+
thread.setName(name);
373+
}
367374
}
368375

369376
@Override

0 commit comments

Comments
 (0)
0