67,542
社区成员
发帖
与我相关
我的任务
分享public void batchData(int begin,int end,int number) throws Exception{
//此处省略部分代码........
logger.info("Start timing task ...");
//是否继续执行转存操作
boolean _is_continue = true;
//统计执行次数
int x =0;
while(_is_continue){
//执行操作
x ++;
_is_continue = backup_takeTableOldToNew(_old_table, _name_temp_task, _date_before_01, number,begin,end);
}
long _end_time = System.currentTimeMillis();
if(logger.isInfoEnabled()){
logger.info("共执行备份转换数据"+x+"次,定时任务每次执行任务数:"+number);
logger.info("End timing task ...,time use : "+(_end_time-_begin_time)/1000+"(secs),msecs:"+(_end_time-_begin_time));
}
}<aop:config>
<aop:pointcut id="serviceMethod"
expression="execution(* com.su.*.service.hander.*ServiceHander.*(..))||execution(* com.su.*.service.down.*ServiceDown.*(..))" />
<aop:advisor pointcut-ref="serviceMethod" advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="backup*" propagation="REQUIRES_NEW" />
<tx:method name="batch*" propagation="REQUIRED" />
<tx:method name="write*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>