diff --git a/src/main/java/ortus/boxlang/runtime/services/ApplicationService.java b/src/main/java/ortus/boxlang/runtime/services/ApplicationService.java index c7b362099..62d8d0ee4 100644 --- a/src/main/java/ortus/boxlang/runtime/services/ApplicationService.java +++ b/src/main/java/ortus/boxlang/runtime/services/ApplicationService.java @@ -141,8 +141,10 @@ public void removeApplication( Key name ) { public void shutdownApplication( Key name ) { Application thisApp = this.applications.get( name ); if ( thisApp != null ) { - thisApp.shutdown( false ); + // remove it first so no one else can access it while it's shutting down this.applications.remove( name ); + // nuke it + thisApp.shutdown( false ); } logger.trace( "ApplicationService.shutdownApplication() - {}", name );