leanup lastCommandOperationContext after command has executed #337

This is to deter acf from holding onto references of context
objects which would otherwise be garbage collected post execution
This commit is contained in:
chickeneer
2022-11-13 18:14:52 -06:00
parent 1f14cbc079
commit 5afde372a2
@@ -153,7 +153,7 @@ public abstract class BaseCommand {
*/
private ExceptionHandler exceptionHandler = null;
/**
* The last operative context data of this command. This may be null if this command hasn't been run yet.
* The last operative context data of this command. This may be null if this command is not currently being executed.
*/
private final ThreadLocal<CommandOperationContext> lastCommandOperationContext = new ThreadLocal<>();
/**
@@ -521,6 +521,7 @@ public abstract class BaseCommand {
*/
private void postCommandOperation() {
CommandManager.commandOperationContext.get().pop();
lastCommandOperationContext.set(null);
execSubcommand = null;
execLabel = null;
origArgs = new String[]{};