Skip to main content
Participant
March 29, 2013
Question

cfthread of coldfusion on different systems-windows and RedHat

  • March 29, 2013
  • 1 reply
  • 632 views

Recently I use cfthread writing a multithread samples. Each thread ask a http request.When I run this cfc file with coldfusion9 on windows, it runs well. Then I run the same cfc file on coldfusion9 on linux(RedHat and centOS), unfortunately, it seems do not work, I found the multi thread do not run parallely, they run one by one. The both coldfusion configuration files are same, and the web server use the built-in one of coldfusion. Is there anyone meet the same probelm? And is there something wrong with cfthread to run on linux? Really need your help. Many thanks!

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
March 29, 2013

Could we see the code? Then it would be easier to debug it.

Participant
May 7, 2013

<cfloop index="pageIndex" from="1" to="#num#" step="1">

                        <cfthread name="thr#pageIndex#" threadIndex="#pageIndex#" action="run">

                                        <cftry>

                                            <cfhttp url="#watson_url#"  method="post" charset="utf-8" timeout="26000000" useragent="#CGI.http_user_agent#" result="THREAD.GETTREAD">

                                       <cfhttpparam type="formfield" name="appGUID" value="#guid#">

                                       <cfhttpparam type="formfield" name="userId" value="#user_id#">

                                       <cfhttpparam type="formfield" name="password" value="#user_pass#">

                                       <cfhttpparam type="formfield" name="sql" value="#TempArr[threadIndex]#">

                                          </cfhttp>

                                          <cfset result_Arr = #DeserializeJSON(THREAD.GETTREAD.Filecontent)#>

                                          <cfset resultArr[threadIndex]=result_Arr >

                                         

                                          <cfcatch type="any">

                                  </cfcatch>

                                    </cftry>

                     

                       </cfthread>

     </cfloop>

TempArr is an array for sql,each thread run a sql and get result from http request.