*/
protected Collection<Result> executeJobQueue( Collection<JobQueue> items ){
Collection<Result> results = null;
if( items == null || items.isEmpty() ){
results = new ArrayList<Result>();
results.add( new Result(false,"参数为空!") );
return results;
}
try{
results = doBusiness(items);//业务处理
if( results == null )
throw new ApplicationException("返回结果为空!");
//Map<String,JobQueue> map = new HashMap<String,JobQueue>();
for(Result result:results ){
JobQueue item = (JobQueue)result.getObject();
if( item == null ){//TODO
throw new ApplicationException("返回结果Result[key="
+result.getKey()+"]关联Object为空!");
}
if( !result.isSuccess() && item != null ){
item.incFailureCount();
item.setStatus(JobQueue.Status.FAILURE );
item.setErrMsg(result.getMessage());
}
}
}catch( Exception e ){
results = new ArrayList<Result>();
for(JobQueue item:items){
results.add(new Result(false,item.getRefId(),item,e.getMessage()));
item.incFailureCount();
item.setStatus( JobQueue.Status.FAILURE );
String errMsg = e.getMessage()+(e.getCause()==null?"":e.getCause().getMessage());