Need a bit of help with CF threads. I’m trying to run an intensive bit of code with cfthread on a coldbox view, so that the main thread loads up the rest of the page quickly and doesn’t get stuck up. My code looks something like this -
#runEvent(event)#
Note that the heavy-duty operation is invoked via runEvent.
Error - " Unable to complete CFML to Java translation. Error information unsupported statement: class coldfusion.compiler.ASTfunctionDefinition "
Aaron,
If I use thread around the actual code in the handler, the piece of code doesn’t get rendered at all -
function heavyDutyFunc(){
// If function is called using runEvent, render out content as widget
if( arguments.widget ){
thread action=“run” name=“t1”
{
return renderView(“vwHeavyDutyOper”);
}
}
}
Pls note that its the rendering of view ‘vwHeavyDutyOper’ (as viewlet on another view) that takes a lot of time because of all the javascript and graphical rendering of results etc. Any help would be greatly appreciated.
Probably I’m missing something. I want to load a viewlet in my view which I do as follows -
I first define a structure (which I want to pass to runEvents() method -
eventStruct = {event=‘module:handler.function’,prepostExempt=true,eventArguments={widget=true,entityID=rc.entityID()}
Then I invoke the runEvent() method in my view - using a thread -
thread action=“run” name=“t1” event=eventStruct{
runEvent(attributes.event);
}
Please advise if this correct? Many thanks for your help.
It didn’t work for me. Gave me the same error - "Unable to complete CFML to Java translation. Error information unsupported statement: class coldfusion.compiler.ASTfunctionDefinition "
Luis,
I’m using CF10. Threads have worked fine for me before, when I used them from my models or handlers. Here’s the full stacktrace when I try to use them with the runEvent() method -
I still get the error -
" Unable to complete CFML to Java translation. Error information unsupported statement: class coldfusion.compiler.ASTfunctionDefinition "
Yes, Andrew, that’s just an example. I generally use createUuid() while naming the threads. Otherwise, it does give ‘Threadname has to be unique’ error (or something similar), but not the error I’m getting right now. I’ve used threads successfully in the past, generally in my models and handlers. This is the first time I tried invoking it from a view (and wrapped around the runEvent() method) - and I get this weird ‘Unable to complete CFML to Java translation.’ error.
Yeah wasn’t sure as I was trying to find out whether that was the case, one thing that I was thinking about and only because it is not clear what line has the error, but have you thought about that it could be something within that handler or method. Have you tried a very basic no thrills method to compare?
I tried that. Doesn’t work either and gives the same old error.
So, the following works fine when invoked in one of my views -
<cfset eventStruct = {event=‘module:handler.myFunc’,prepostExempt=true,eventArguments={widget=true,entityID=rc.entityID()}}> #runEvent(argumentCollection=eventStruct)#
While this doesn’t -
<cfset eventStruct = {event=‘module:handler.myFunc’,prepostExempt=true,eventArguments={widget=true,entityID=rc.entityID}}>
#runEvent(argumentCollection=attributes.event)#
Andrew,
I just tried with a very basic handler for testing -
function myFunc(event,rc,prc){
return renderView(“testFile”);
}
where testFile.cfm contains just the following html -