3.6 Specifying Conditions for Task Execution

The Task class can allow conditional execution of the task using the shouldRun(HttpServletRequest, String) method inherited from BaseGadgetInstance.

To check conditions to determine whether the task should run, overwrite the shouldRun method. Be sure to call super.shouldRun() to let the system check device types. The shouldRun method is a static method, which means that it can be run before your task is instantiated, only when the class is loaded. The following is the declaration for shouldRun:

 static public void shouldRun(HttpServletRequest req, String sServiceName)
    throws Exception