setThreadPriority(newPriority)
Last updated February 10, 2005
Version: 1 | Requires: CF6 | Library: UtilityLib
	Description: 
	By default, ColdFusion (by way of Java) schedules all threads to run at a priority of 5. This means that computing cycles are distributed to each thread evenly. This function allows you to adjust that priority and tell CF (Java) which threads are more important and which can wait.
This function is great for utility applications that run in the background and hog the CPU. By setting those apps to a lower priority, they will yield system resources to other requests, such as requests to your web site. 
Conversely you can set mission critical apps to a higher priority ensuring that they can max out system resources if they need to.
	Return Values: 
	Returns a boolean.
Example:
<cfset foo = setThreadPriority(3)>
Parameters:
| Name | Description | Required | 
|---|---|---|
| newPriority | Thread priority. | Yes | 
Full UDF Source:
/**
 * Allows you to set the scheduling priority of the current thread.
 * 
 * @param newPriority      Thread priority. (Required)
 * @return Returns a boolean. 
 * @author Joe Bernard (cfdev@comcast.net) 
 * @version 1, February 10, 2005 
 */
function setThreadPriority(newPriority) {
    var thread = createObject("java", "java.lang.Thread");
    if (arguments.newPriority le thread.max_priority and arguments.newPriority ge thread.min_priority) {
        thread.setPriority(arguments.newPriority);
        return true;
    } else {
        return false;
    }
}
Search CFLib.org
Latest Additions
									
									Raymond Camden added 
									QueryDeleteRows 
									November 04, 2017
								
								
									
									Leigh added 
									nullPad 
									May 11, 2016
								
								
									
									Raymond Camden added 
									stripHTML 
									May 10, 2016
								
								
									
									Kevin Cotton added 
									date2ExcelDate 
									May 05, 2016
								
								
									
									Raymond Camden added 
									CapFirst 
									April 25, 2016