[CB] extending an existing application

Hi all,
I’m using ColdBox to extend an existing code base running on a CF 2016 server.
My CB application is in a subdirecory of the existing code (/newdev)
/newdev/Application.cfc extends /Application.cfc and calls super.onApplictionStart() and super.onRequestStart()

/newdev/Application.cfc defines this.Ormsettings and this.datasource and it works fine, but I’m experiencing a problem (race conditions)

Let’s say client A request page /newdev/index.cfm
She is able to get this.Ormsettings and this.datasource using getApplicationMetadata() (this is indeed called by getDefaultDatasource() in /newdev/cborm/models/util/OrmUtilSupport.cfc)

But, if there is a second client (B) that, between client A request and client A trying to access getApplicationMetadata(), requests a page in the legacy area, let’s say /index.cfm, when client A calls getApplicationMetadata(), she is not able to get this.Ormsettings and this.datasource anymore.

In my understanding the application metadata get rewritten by client B request (so the race condition)

Provided that

  1. the new development must use the legacy Application.cfc (that implements validation and so on)
  2. I need to share client variables (defined by the legacy app)

Any suggestion on how to use CB to extend the existing app without putting the initialization code in /Application.cfc? (if this could be a solution!)

thank you in advance