Description
Get the total number of scripts allowed on the stack before the scraping session is forcibly stopped.
Parameters
This method does not receive any parameters.
Return Values
Returns max number of scripts that can be running at a time, 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.");
}