Now that the ColdFusion server runs on top of a Java subsystem, I thought it was time for the Server scope to actually contain information about the Java server as well as the CFML processor. The Enhancer adds a new JVM key to the Server scope and adds more keys to the Server.OS structure.
*click image to view full size

New keys:
Of course, you can remove any information that you don’t want from the code, but even on my wimpy 500MB RAM/1.33 MHz laptop, execution time for the code was max 67ms and averaged about 32ms.
I made two versions of the code. All of the features descibed above are in the JDK 1.5 version. The 1.4 version still adds some memory values and has the Thread query, but the 1.4 JDK just doesn’t have as many features.
Download Server Scope Enhancer JDK 1.5
Download Server Scope Enhancer JDK 1.4
3 Responses for "Server Scope Enhancer"
Steve, this looks very interesting. And indeed, I like a lot of what I see here in your blog. I will subscribe to your feed and look forward to pointing people to it.
On this cfml template you offer, though (looking at the 1.4 version), I got an error off the bat (on CFMX 6.1). The QueryNew function mistakenly has
server.jvm.threads = QueryNew(“id, name, group, alive, interrupted, stackframes, priority, daemon”, “Integer, VarChar, VarChar, Bit, Bit, Integer, Integer, Bit”);
which is wrong (due to the quotes around the comma between daemon and integer). Instead it should be:
server.jvm.threads = QueryNew(“id, name, group, alive, interrupted, stackframes, priority, daemon,Integer, VarChar, VarChar, Bit, Bit, Integer, Integer, Bit”);
Curiously, that mistake passes fine on CFMX 7, so perhaps you hadn’t noticed it.
Finally, for users who try it and find it “does nothing”,
note from the blog entry (and looking at the code) that he’s simply added new info to the Server scope. You need to do something with it. A simple thing is to dump it:
But you could also format it more usefully and even do things with the data. But Steve’s got you started. Have at it. :-) Thanks again, Steve.
BTW, I do wish you’d consider having an email signup for comments (and even blog posts). Not everyone relies on RSS readers. For others who may want to keep up with his stuff but have no RSS reader, check out a post I did on how to track RSS feeds via email:
http://www.tipicalcharlie.com/blog_email_notification_by_squeet.htm
Thanks for the tip on the code, Charlie. I don\\\’t have 6.1 to test on anymore, so it is nice to get free testing. I willl make the change in the code.
Also, good suggestion on the Squeet service. I just signed up and have the box on my site.
* Addendum: The function definition actually changed from 6.1 to 7, so for the sake of currency, I will keep the comma-seperated parameters in there.
[...] September 19th, 2006 My previous post about a ColdFusion Server scope enhancer provided a chunk of code that you could include somewhere in your application to provide much more detailed information about the state and properties of your Java application server. [...]
Leave a reply