public void execute(JobExecutionContext context) throws JobExecutionException {
  executions.incrementAndGet();
  try {
    if (status == STATE.RUNNING)     return;
    status=STATE.RUNNING;
    execute();
  }
 catch (  Exception e) {
    status=STATE.ERROR;
    logger.error("Could not execute the task because of " + e.getMessage(),e);
    errors.incrementAndGet();
  }
catch (  Throwable e) {
    status=STATE.ERROR;
    logger.error("Could not execute the task because of " + e.getMessage(),e);
    errors.incrementAndGet();
  }
  if (status != STATE.ERROR)   status=STATE.DONE;
}

public void execute ( JobExecutionContext context ) throws JobExecutionException { executions . incrementAndGet ( ) ; try { if ( status == STATE . RUNNING ) return ; status = STATE . RUNNING ; execute ( ) ; } catch ( Exception e ) { status = STATE . ERROR ; logger . error ( "Could not execute the task because of " + e . getMessage ( ) , e ) ; errors . incrementAndGet ( ) ; } catch ( Throwable e ) { status = STATE . ERROR ; logger . error ( "Could not execute the task because of " + e . getMessage ( ) , e ) ; errors . incrementAndGet ( ) ; } if ( status != STATE . ERROR ) status = STATE . DONE ; }
main method to execute a task
