Brandon Brown
04/19/2022, 3:59 PMapplication.wirebox.getInstance('testing')
I am using a java library that opens a socket and will receive requests that triggers a CFC. However the application scope isn't the same application scope as the one I created the listener instance from, it is basically empty, so any variables created in the application scope are inaccessible.Brandon Brown
04/19/2022, 4:11 PMthisOldDave
04/20/2022, 8:59 AMExtending The Application.cfc ColdFusion
@ben has written a few blogs on the subjectbdw429s
04/20/2022, 4:07 PMbdw429s
04/20/2022, 4:07 PMbdw429s
04/20/2022, 4:07 PMbdw429s
04/20/2022, 4:09 PMbdw429s
04/20/2022, 4:09 PMbdw429s
04/20/2022, 4:10 PMbdw429s
04/20/2022, 4:10 PMbdw429s
04/20/2022, 4:12 PMBrandon Brown
04/20/2022, 4:12 PMbdw429s
04/20/2022, 4:13 PMinit()
method and store it in the CFC
• When the CFC has a method invoked later in a separate thread created by a java library it will have an empty page context
• so it calls loadContext() and unloadContext() to get its information backbdw429s
04/20/2022, 4:14 PMrequest
(which you may or may not need) due to stupid bugs in Lucee that I couldn't get Micha to fix
but we use this basic idea in several places and it works pretty goodbdw429s
04/20/2022, 4:16 PMbdw429s
04/20/2022, 4:16 PMbdw429s
04/20/2022, 4:16 PMBrandon Brown
04/20/2022, 4:23 PMbdw429s
04/20/2022, 4:25 PMbdw429s
04/20/2022, 4:26 PMbdw429s
04/20/2022, 4:26 PMbdw429s
04/20/2022, 4:27 PMbdw429s
04/20/2022, 4:28 PMbdw429s
04/20/2022, 4:29 PMbdw429s
04/20/2022, 4:30 PMassociateThread( application="myApp" );
try {
// run My logic inside some random thread
} finally {
// removes contexts from ThreadLocal
diassociateThread();
}
bdw429s
04/20/2022, 4:32 PMrunThreadInContext( application="myApp", udf=()=>{
// run My logic inside some random thread
} );
providing the logic to run in a closure would reduce boilerplate and allow for auto-cleanupbdw429s
04/20/2022, 4:32 PMbdw429s
04/22/2022, 7:08 PMBrandon Brown
04/27/2022, 8:21 PMrequest
scope not being carried over which is expected. However it seems to return an immutable request
scope when I am trying to set a variable in that scope. Have you found a workaround for this?bdw429s
04/27/2022, 8:21 PMbdw429s
04/27/2022, 8:21 PMBrandon Brown
04/27/2022, 8:22 PMBrandon Brown
04/27/2022, 8:23 PMbdw429s
04/27/2022, 8:23 PMBaseLisetnerNew.cfc
?Brandon Brown
04/27/2022, 8:24 PMBrandon Brown
04/27/2022, 8:24 PMbdw429s
04/27/2022, 8:27 PMbdw429s
04/27/2022, 8:34 PMBrandon Brown
04/27/2022, 8:34 PMbdw429s
04/27/2022, 8:57 PMbdw429s
04/27/2022, 8:57 PMbdw429s
04/27/2022, 8:57 PMBrandon Brown
04/27/2022, 8:58 PMBrandon Brown
04/27/2022, 9:02 PMBrandon Brown
04/27/2022, 9:39 PMbdw429s
04/27/2022, 10:05 PMbdw429s
04/27/2022, 10:05 PMbdw429s
04/27/2022, 10:07 PMbdw429s
04/27/2022, 10:08 PMbdw429s
04/27/2022, 10:09 PMBrandon Brown
04/28/2022, 12:36 PMbdw429s
04/28/2022, 5:51 PM