code: private void checkTaskForExecution(ApplicationDefinition appDef, Task task) {
          Tenant tenant = Tenant.getTenant(appDef);
          m_logger.debug("Checking task '{}' in tenant '{}'", task.getTaskID(), tenant);
          synchronized (m_executeLock) {
              Iterator<DColumn> colIter =
                  DBService.instance(tenant).getAllColumns(TaskManagerService.TASKS_STORE_NAME, task.getTaskID()).iterator();
              TaskRecord taskRecord = null;
              if (!colIter.hasNext()) {
                  taskRecord = storeTaskRecord(tenant, task);
              } else {
                  taskRecord = buildTaskRecord(task.getTaskID(), colIter);
              }
              if (taskShouldExecute(task, taskRecord) && canHandleMoreTasks()) {
                  attemptToExecuteTask(appDef, task, taskRecord);
              }
          }
      }
docs: Check the given task to see if we should and can execute it.