Package com.thenetcircle.comsumerdispatcher.job

Source Code of com.thenetcircle.comsumerdispatcher.job.JobAssign

package com.thenetcircle.comsumerdispatcher.job;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.thenetcircle.comsumerdispatcher.config.DispatcherConfig;
import com.thenetcircle.comsumerdispatcher.thread.ConsumerJobExecutorPool;


public class JobAssign {
  private static Log _logger = LogFactory.getLog(JobAssign.class);

  public void startupJobs() {
    //get all jobs from config
    List<JobExecutor> allJobs = DispatcherConfig.getInstance().getAllJobs();
   
    if (null != allJobs && !allJobs.isEmpty()) {
      int jobcount = 0;
     
      // init a executor pool for each job definition
      for (JobExecutor job : allJobs) {
        ConsumerJobExecutorPool ep = new ConsumerJobExecutorPool(job);
        jobcount += ep.startJobExecutors();
      }

      _logger.info("===== started up " + jobcount + " jobs ====");
    }
  }

  public void shutdownAllTask() {
  }
}
TOP

Related Classes of com.thenetcircle.comsumerdispatcher.job.JobAssign

TOP
Copyright © 2018 www.massapi.com. 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.