Package com.google.code.lightssh.project.scheduler.entity

Examples of com.google.code.lightssh.project.scheduler.entity.JobQueue


   
    if( page == null )
      page = new ListPage<JobQueue>();
   
    page.addAscending("createdTime");
    JobQueue t = new JobQueue();
    SchedulerType type = new SchedulerType();
    type.setId(jobTypeId);
    t.setType( type );
   
    return list(page, t);
  }
View Full Code Here


    if( type == null )
      throw new ApplicationException("工作任务类型["+jobType+"]不存在!");
   
    List<JobQueue> queues = new ArrayList<JobQueue>();
    for(String refId:refIds ){
      JobQueue exists = getDao().get(jobType,refId);
      if( exists != null ){
        log.warn("任务[类型={}][关联ID={}]已存在队列!",jobType,refId);
        continue;
      }
     
      JobQueue queue = new JobQueue();
      queue.setType(type);
      queue.setRefId(refId);
      queue.setCreatedTime( Calendar.getInstance() );
      queue.setMaxSendCount(maxSendCount);
      queue.setFailureCount(0);
      queue.setStatus(JobQueue.Status.NEW);
      queue.setInvokeTime(invokeTime);
     
      queues.add(queue);
    }
   
    if( !queues.isEmpty() )
View Full Code Here

        ec.setFinishedTime(Calendar.getInstance());
        ec.setStatus( Status.SUCCESS );
      }else{
        ec.setStatus( Status.FAILURE );
        if( result.getObject() != null && result.getObject() instanceof JobQueue ){
          JobQueue jq = (JobQueue)result.getObject();
          ec.incFailureCount( jq.getFailureCount());
          ec.setErrMsg(jq.getErrMsg());
        }
      }
    }
   
    dao.update(list);
View Full Code Here

      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());
        item.setErrMsg( errMsg.length()>199?errMsg.substring(0,199):errMsg );
       
        log.error("任务队列[id="+item.getIdentity()+",type="
            +item.getType().getName()+",ref_id="
            +item.getRefId()+"]执行异常:",e);
      }
     
    }
   
    List<JobQueue> outQueues = new ArrayList<JobQueue>();//成功队列
    List<JobQueue> updateQueues = new ArrayList<JobQueue>();//更新队列
    for(Result item:results ){
      JobQueue jobQueue = (JobQueue)item.getObject();
      if( item.isSuccess() || jobQueue.isDeletable() )
        outQueues.add(jobQueue);
      else
        updateQueues.add(jobQueue);
    }
   
View Full Code Here

TOP

Related Classes of com.google.code.lightssh.project.scheduler.entity.JobQueue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.