获取ColdFusion 9标准版中正在运行的请求的列表 [英] Getting a list of running requests in ColdFusion 9 standard edition
问题描述
有没有人知道,如果有一种方式在Adobe ColdFusion 9标准版,以获得正在运行的请求的列表?也许通过从一个CF Java对象调用一个方法,如coldfusion.server.ServiceFactory?
Does anyone know if there is a way in Adobe ColdFusion 9 standard edition to get a list of the running requests? Maybe by invoking a method from one of the CF Java objects, like coldfusion.server.ServiceFactory???
我知道在企业中你可以使用服务器监视器因为我们使用的是标准版,我们没有可用的服务器监视器。
I know in enterprise you can use the server monitor for this but as we are using standard edition we do not have the server monitor available.
谢谢。
推荐答案
感谢@barnyr的引导我已经设法得到一些代码,将输出当前运行的脚本名称的列表,这正是我需要的。这里是任何有兴趣的人。
Thanks to the steer from @barnyr I have managed to get some code that will output a list of the currently running script names, which is exactly what I needed. Here it is for anyone who is interested.
<!--- Create the thread object --->
<cfobject type="JAVA" action="Create" name="thread" class="java.lang.Thread">
<!--- Get all stack traces from the thread object --->
<cfset stackTrace = thread.getAllStackTraces()>
<!--- Convert the entrySet into an array --->
<cfset stackArray = stackTrace.entrySet().toArray()>
<cfoutput>
<!--- Loop over the entrySet array --->
<cfloop from="1" to="#ArrayLen(stackArray)#" index="sIndex">
<!--- Get the current thread values --->
<cfset thisThread = stackArray[sIndex].getValue()>
<!--- Loop over current thread values --->
<cfloop from="1" to="#ArrayLen(thisThread)#" index="tIndex">
<!--- Get the filename for this thread --->
<cfset thisThreadFile = thisThread[tIndex].getFileName()>
<!--- If the file name contains .cfm output it --->
<cfif isDefined("thisThreadFile") AND thisThreadFile CONTAINS ".cfm">
#thisThreadFile#<br>
</cfif>
</cfloop>
</cfloop>
</cfoutput>
这篇关于获取ColdFusion 9标准版中正在运行的请求的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!