@Test public void testProvisionInterrupted() { ProvisioningManager manager = new ProvisioningManager(); AtomicInteger completedJobs = new AtomicInteger(0); manager.provision(new ShutdownExecutorJob(manager, completedJobs)); manager.provision(new MockJob(0, "rejected", completedJobs)); assertEquals(completedJobs.get(), 1); }
public Object provision(ProvisioningJob job) { if (terminated.get()) { logger.warn("Job(%s) submitted but the provisioning manager is already closed", job); return null; } logger.debug("Job(%s) submitted to group '%s'", job, job.getGroup()); ListeningExecutorService workerGroup = getWorkerGroup(job.getGroup()); return getUnchecked(workerGroup.submit(job)); }
ProvisioningManager implements Closeable { public Object provision(ProvisioningJob job) { if (terminated.get()) { logger.warn("Job(%s) submitted but the provisioning manager is already closed", job); return null; } logger.debug("Job(%s) submitted to group '%s'", job, job.getGroup()); ListeningExecutorService workerGroup = getWorkerGroup(job.getGroup()); return getUnchecked(workerGroup.submit(job)); } }
ProvisioningManager implements Closeable { public Object provision(ProvisioningJob job) { if (terminated.get()) { logger.warn("Job(%s) submitted but the provisioning manager is already closed", job); return null; } logger.debug("Job(%s) submitted to group '%s'", job, job.getGroup()); ListeningExecutorService workerGroup = getWorkerGroup(job.getGroup()); return getUnchecked(workerGroup.submit(job)); }  }
ProvisioningManager implements Closeable { public Object provision(ProvisioningJob job) { if (terminated.get()) { logger.warn("Job(%s) submitted but the provisioning manager is already closed", job); return null; } logger.debug("Job(%s) submitted to group '%s'", job, job.getGroup()); ListeningExecutorService workerGroup = getWorkerGroup(job.getGroup()); return getUnchecked(workerGroup.submit(job)); }  Object provision(ProvisioningJob job); @Override void close(); }
ProvisioningManager implements Closeable { public Object provision(ProvisioningJob job) { if (terminated.get()) { logger.warn("Job(%s) submitted but the provisioning manager is already closed", job); return null; } logger.debug("Job(%s) submitted to group '%s'", job, job.getGroup()); ListeningExecutorService workerGroup = getWorkerGroup(job.getGroup()); return getUnchecked(workerGroup.submit(job)); }  Object provision(ProvisioningJob job); @Override void close();  }