agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/queue/JobSubmissionSchedulingPlugin.java
/**
     * Performs cleanup and rollback tasks for the currently allocated jobs
     * in this vm.
     */
Performs cleanup and rollback tasks for the currently allocated jobs
in this vm.
Performs cleanup and rollback tasks for the currently allocated jobs in this vm .
@Override
	public void shutdown()
	{
		try
		{
			log.debug("Shutting down " + getPluginGroup().toLowerCase() + " queue...");
			for (JobExecutionContext jobContext : scheduler.getCurrentlyExecutingJobs())
			{
				Job job = jobContext.getJobInstance();
				if (job instanceof MessageQueueListener) {
					((MessageQueueListener)job).stop();
				}
				else if (job instanceof InterruptableJob) {
					((InterruptableJob)job).interrupt();
				}
			}
		}
		catch (NullPointerException | SchedulerException e) {
		    log.error("Failed to shut down " + getPluginGroup() + "queue properly.", e);
		} finally {
			for (String uuid: AbstractJobProducerFactory.getSubmissionjobtaskqueue()) {
				log.debug("Rolling back submitting job " + uuid + " prior to shutdown.");
				try {
					org.iplantc.service.jobs.model.Job j = JobDao.getByUuid(uuid);
					if (j != null) {
						log.debug("Located submitting job " + uuid + " for rollback during shutdown.");
						JobManager.resetToPreviousState(j, "admin");
						log.debug("Successfully rolled back submitting job " + uuid + " during shutdown.");
					}
					else {
						log.debug("Unable to locate submitting job " + uuid + " for rollback. "
								+ "This job will be in a zombie state when the container restarts.");
					}
				}
				catch (Throwable t) {
					log.debug("Rollback of submitting job " + uuid + " failed during shutdown.", t);
				}
			}
		}
	}
@ Override public void shutdown ( ) { try { log . debug ( "Shutting down " + getPluginGroup ( ) . toLowerCase ( ) + " queue..." ) ; for ( JobExecutionContext jobContext : scheduler . getCurrentlyExecutingJobs ( ) ) { Job job = jobContext . getJobInstance ( ) ; if ( job instanceof MessageQueueListener ) { ( ( MessageQueueListener ) job ) . stop ( ) ; } else if ( job instanceof InterruptableJob ) { ( ( InterruptableJob ) job ) . interrupt ( ) ; } } } catch ( NullPointerException | SchedulerException e ) { log . error ( "Failed to shut down " + getPluginGroup ( ) + "queue properly." , e ) ; } finally { for ( String uuid : AbstractJobProducerFactory . getSubmissionjobtaskqueue ( ) ) { log . debug ( "Rolling back submitting job " + uuid + " prior to shutdown." ) ; try { org . iplantc . service . jobs . model . Job j = JobDao . getByUuid ( uuid ) ; if ( j != null ) { log . debug ( "Located submitting job " + uuid + " for rollback during shutdown." ) ; JobManager . resetToPreviousState ( j , "admin" ) ; log . debug ( "Successfully rolled back submitting job " + uuid + " during shutdown." ) ; } else { log . debug ( "Unable to locate submitting job " + uuid + " for rollback. " + "This job will be in a zombie state when the container restarts." ) ; } } catch ( Throwable t ) { log . debug ( "Rollback of submitting job " + uuid + " failed during shutdown." , t ) ; } } } }
Performs cleanup and rollback tasks for the currently allocated jobs
 in this vm.
Performs cleanup and rollback tasks for the currently allocated jobs in this vm .
// nothing to do here. scheduler is already shutting down. // happens when the scheduler wasn't initialized properly. Ususally due to us // disabling it completely.