Skip to content

Commit 66aee8e

Browse files
committed
Modify runnable wrapping
1 parent 2f9b20e commit 66aee8e

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

operator/src/main/java/oracle/kubernetes/operator/helpers/ClientPool.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,24 @@ public class ClientPool extends Pool<ApiClient> {
3131
public static void initialize(ThreadFactory threadFactory) {
3232
ClientPool.threadFactory =
3333
(r) -> {
34-
return threadFactory.newThread(
35-
() -> {
36-
try {
37-
r.run();
38-
} catch (Throwable t) {
39-
// These will almost always be spurious exceptions
40-
LOGGER.fine(MessageKeys.EXCEPTION, t);
41-
}
42-
});
34+
return threadFactory.newThread(wrapRunnable(r));
4335
};
4436
}
4537

38+
private static Runnable wrapRunnable(Runnable r) {
39+
return new Runnable() {
40+
@Override
41+
public void run() {
42+
try {
43+
r.run();
44+
} catch (Throwable t) {
45+
// These will almost always be spurious exceptions
46+
LOGGER.fine(MessageKeys.EXCEPTION, t);
47+
}
48+
}
49+
};
50+
}
51+
4652
public static ClientPool getInstance() {
4753
return SINGLETON;
4854
}

0 commit comments

Comments
 (0)