Search in sources :

Example 1 with ShardingItemCallable

use of com.vip.saturn.job.basic.ShardingItemCallable in project Saturn by vipshop.

the class SaturnScriptJob method innerHandleWithListener.

protected SaturnJobReturn innerHandleWithListener(String jobName, Integer item, String execParameter, SaturnExecutionContext shardingContext) {
    ShardingItemCallable callable = createShardingItemCallable(jobName, item, execParameter, shardingContext);
    shardingItemCallableList.add(callable);
    beforeExecution(callable);
    SaturnJobReturn saturnJobReturn = null;
    try {
        saturnJobReturn = innerHandle(callable);
    } catch (Throwable t) {
        LogUtils.error(log, jobName, t.getMessage(), t);
        saturnJobReturn = new SaturnJobReturn(SaturnSystemReturnCode.USER_FAIL, t.getMessage(), SaturnSystemErrorGroup.FAIL);
    }
    callable.setSaturnJobReturn(saturnJobReturn);
    afterExecution(callable);
    LogUtils.debug(log, jobName, "job:{} item:{} finish execution, which takes {}ms", jobName, item, callable.getExecutionTime());
    return saturnJobReturn;
}
Also used : SaturnJobReturn(com.vip.saturn.job.SaturnJobReturn) ShardingItemCallable(com.vip.saturn.job.basic.ShardingItemCallable)

Aggregations

SaturnJobReturn (com.vip.saturn.job.SaturnJobReturn)1 ShardingItemCallable (com.vip.saturn.job.basic.ShardingItemCallable)1