Description
Get the number of scripts currently running.
Parameters
This method does not receive any parameters.
Return Values
Returns number of running scripts, as an integer.
Change Log
Version |
Description |
5.0 |
Added for all editions. |
import java.math.*;
// Get Number of Scripts (running and max)
BigDecimal numRunningScripts = new BigDecimal(session.getNumScriptsOnStack());
BigDecimal maxAllowedScripts = new BigDecimal(session.getMaxScriptsOnStack());
// Calculate percentage used
BigDecimal percentageUsedBD = numRunningScripts.divide(maxAllowedScripts, 2, BigDecimal.ROUND_HALF_UP);
double percentageUsed = percentageUsedBD.doubleValue();
if (percentageUsed < 90)
{
session.log(percentageUsed.toString() + "% of max scripts used");
}
else
{
session.logWarn("90% max scripts threshold has been reached.");
}