예제 #1
0
 /**
  * Creates a new instance given a configuration and a load balancer.
  *
  * @param config The configuration details for this job scheduler.
  * @param balancer The load balancer to use for distributing jobs.
  */
 public MeandreJobScheduler(MeandreJobSchedulerConfig config, MeandreLoadBalancer balancer) {
   loadBalancer = balancer;
   workers = config.getServers();
   for (MeandreServerProxy server : workers) {
     loadBalancer.addServer(server);
   }
 }
예제 #2
0
 /** Initializes this instance. */
 @PostConstruct
 public void init() {
   assert config != null : "No configuration was provided to the job scheduler.";
   workers = config.getServers();
   for (MeandreServerProxy server : workers) {
     loadBalancer.addServer(server);
   }
 }
예제 #3
0
 /**
  * Add a server to the job scheduler.
  *
  * @param server Server to add.
  */
 public void addServer(MeandreServerProxy server) {
   workersLock.lock();
   try {
     workers.add(server);
     loadBalancer.addServer(server);
   } finally {
     workersLock.unlock();
   }
 }