Skip to content

Commit

Permalink
Application shutdown - Rely on context in event args
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelborn committed Nov 13, 2024
1 parent cc77a97 commit 70fbbfa
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ortus.boxlang.modules.orm.ORMApp;
import ortus.boxlang.modules.orm.ORMService;
import ortus.boxlang.modules.orm.config.ORMConfig;
import ortus.boxlang.modules.orm.config.ORMKeys;
import ortus.boxlang.runtime.BoxRuntime;
import ortus.boxlang.runtime.application.Application;
import ortus.boxlang.runtime.context.RequestBoxContext;
import ortus.boxlang.runtime.events.InterceptionPoint;
import ortus.boxlang.runtime.types.IStruct;
Expand Down Expand Up @@ -63,13 +61,8 @@ public void afterApplicationListenerLoad( IStruct args ) {
@InterceptionPoint
public void onApplicationEnd( IStruct args ) {
logger.info( "onApplicationEnd fired; cleaning up ORM resources for this application context" );
Application app = ( Application ) args.get( "application" );
// @TODO: Fix - BoxLang does not emit the context with this event.
RequestBoxContext context = ( RequestBoxContext ) args.get( "context" );
if ( context == null ) {
context = RequestBoxContext.getCurrent();
}
ORMService.getInstance().shutdownApp( ORMApp.getUniqueAppName( app, app.getStartingListener().getSettings() ) );
RequestBoxContext context = ( RequestBoxContext ) args.get( "context" );
ORMService.getInstance().shutdownApp( context );
}

/**
Expand Down

0 comments on commit 70fbbfa

Please sign in to comment.