Greg's Blog

helping me remember what I figure out

Setting the CFMX Thread Priority

| Comments

Now this is pretty cool. Again from the CF-talk list, Joe Bernard has shown how to access the CFMS thread Priority information and how to increase/decrease it. As almost per usual now, you need to dig into the Java layer:

<cfscript>
thread = createObject(“java”, “java.lang.Thread”);
// get current thread priority
currp = thread.getPriority();
// what’s the max
maxp = thread.getThreadGroup().getMaxPriority();
// set the priority
thread.setPriority(3);
newrrp = thread.getPriority();

writeOutput(“Current: ” & currp & “<br />”);
writeOutput(“Max: ” & maxp & “<br />”);
writeOutput(“New: ” & newrrp & “<br />”);
</cfscript>