Skip to content

Commit

Permalink
Merge pull request #21041 from geoand/startup-context-polish
Browse files Browse the repository at this point in the history
Apply minor polish to StartupContext
  • Loading branch information
geoand authored Oct 28, 2021
2 parents 21e5820 + d41edb8 commit 42e2886
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions core/runtime/src/main/java/io/quarkus/runtime/StartupContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,26 @@ public class StartupContext implements Closeable {

private final Map<String, Object> values = new HashMap<>();
private Object lastValue;
// this is done to distinguish between the value never having been set and having been set as null
// this is done to distinguish between the value having never been set and having been set as null
private boolean lastValueSet = false;
private final List<Runnable> shutdownTasks = new ArrayList<>();
private final List<Runnable> lastShutdownTasks = new ArrayList<>();
private final ShutdownContext shutdownContext = new ShutdownContext() {
@Override
public void addShutdownTask(Runnable runnable) {
shutdownTasks.add(runnable);
}

@Override
public void addLastShutdownTask(Runnable runnable) {
lastShutdownTasks.add(runnable);
}
};
// the initial capacity was determined experimentally for a standard set of extensions
private final List<Runnable> shutdownTasks = new ArrayList<>(9);
private final List<Runnable> lastShutdownTasks = new ArrayList<>(7);
private String[] commandLineArgs;
private String currentBuildStepName;

public StartupContext() {
ShutdownContext shutdownContext = new ShutdownContext() {
@Override
public void addShutdownTask(Runnable runnable) {
shutdownTasks.add(runnable);
}

@Override
public void addLastShutdownTask(Runnable runnable) {
lastShutdownTasks.add(runnable);
}
};
values.put(ShutdownContext.class.getName(), shutdownContext);
values.put(RAW_COMMAND_LINE_ARGS, new Supplier<String[]>() {
@Override
Expand Down

0 comments on commit 42e2886

Please sign in to comment.