From 7a385dff3afed19ae74f1f7e51dc36b74ac00481 Mon Sep 17 00:00:00 2001 From: Martin Kouba Date: Wed, 3 Jul 2024 08:46:51 +0200 Subject: [PATCH] Core: minor refactoring of StartupContext - remove unused fields and methods - add a comment to StartupContext#values --- .../io/quarkus/runtime/StartupContext.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/core/runtime/src/main/java/io/quarkus/runtime/StartupContext.java b/core/runtime/src/main/java/io/quarkus/runtime/StartupContext.java index 268768f1942ab..a06f7f2063349 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/StartupContext.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/StartupContext.java @@ -15,10 +15,11 @@ public class StartupContext implements Closeable { private static final Logger LOG = Logger.getLogger(StartupContext.class); + // Holds values for returned proxies + // These values are usually returned from recorder methods but can be also set explicitly + // For example, the raw command line args and ShutdownContext are set when the StartupContext is created private final Map values = new HashMap<>(); - private Object lastValue; - // this is done to distinguish between the value having never been set and having been set as null - private boolean lastValueSet = false; + private final Deque shutdownTasks = new ConcurrentLinkedDeque<>(); private final Deque lastShutdownTasks = new ConcurrentLinkedDeque<>(); private String[] commandLineArgs; @@ -58,28 +59,17 @@ public String[] get() { public void putValue(String name, Object value) { values.put(name, value); - lastValueSet = true; - this.lastValue = value; } public Object getValue(String name) { return values.get(name); } - public Object getLastValue() { - return lastValue; - } - - public boolean isLastValueSet() { - return lastValueSet; - } - @Override public void close() { runAllAndClear(shutdownTasks); runAllAndClear(lastShutdownTasks); values.clear(); - lastValue = null; } private void runAllAndClear(Deque tasks) {