Skip to content

Commit

Permalink
COLDBOX-1275
Browse files Browse the repository at this point in the history
Improved engine detection by the CFMLEngine feature class
  • Loading branch information
lmajano committed Apr 10, 2024
1 parent 7c006a3 commit 42e7706
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions system/async/proxies/BaseProxy.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ component accessors="true" {
variables.UUID = createUUID();
variables.loadAppContext = arguments.loadAppContext;

variables.isLucee = server.keyExists( "lucee" );
variables.isAdobe = server.keyExists( "coldfusion" ) && server.coldfusion.productName.findNocase( "ColdFusion" ) > 0;

// If loading App context or not
if ( arguments.loadAppContext ) {
if ( server.keyExists( "lucee" ) ) {
if ( variables.isLucee ) {
variables.cfContext = getCFMLContext().getApplicationContext();
variables.pageContext = getCFMLContext();
} else {
} else if ( variables.isAdobe ) {
variables.DataSrcImplStatic = createObject( "java", "coldfusion.sql.DataSrcImpl" );
variables.fusionContextStatic = createObject( "java", "coldfusion.filter.FusionContext" );
variables.originalFusionContext = fusionContextStatic.getCurrent().clone();
Expand Down Expand Up @@ -102,9 +105,9 @@ component accessors="true" {

try {
// Lucee vs Adobe Implementations
if ( server.keyExists( "lucee" ) ) {
if ( variables.isLucee ) {
getCFMLContext().setApplicationContext( variables.cfContext );
} else {
} else if ( variables.isAdobe ) {
// Set the current thread's class loader from the CF space to avoid
// No class defined issues in thread land.
getCurrentThread().setContextClassLoader(
Expand Down Expand Up @@ -162,8 +165,7 @@ component accessors="true" {

try {
// Lucee vs Adobe Implementations
if ( server.keyExists( "lucee" ) ) {
} else {
if ( variables.isAdobe ) {
// Ensure any DB connections used get returned to the connection pool. Without clearSqlProxy an executor will hold onto any connections it touched while running and they will not timeout/close, and no other code can use the connection except for the executor that last touched it. Credit to Brad Wood for finding this!
variables.DataSrcImplStatic.clearSqlProxy();
variables.fusionContextStatic.setCurrent( javacast( "null", "" ) );
Expand Down Expand Up @@ -197,10 +199,10 @@ component accessors="true" {
* Amend this check once Adobe fixes this in a later update
*/
function getConcurrentEngineLockName(){
if ( server.keyExists( "lucee" ) ) {
return createUUID();
} else {
if ( variables.isAdobe ) {
return variables.UUID;
} else {
return createUUID();
}
}

Expand Down

0 comments on commit 42e7706

Please sign in to comment.