agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/dao/JobDao.java
/**
	 * Returns all zombie jobs which have active transfers that have not been 
	 * updated in the last 15 minutes or which have been in intermediate 
	 * statuses without transfers for over an hour.
	 *
	 * @param tenantId the tenant for which to search.
	 * @return {@link List<Long>} of zombie {@link Job} ids
	 */
Returns all zombie jobs which have active transfers that have not been
updated in the last 15 minutes or which have been in intermediate
statuses without transfers for over an hour.

@param tenantId the tenant for which to search.
@return  List of zombie  Job ids
Returns all zombie jobs which have active transfers that have not been updated in the last 15 minutes or which have been in intermediate statuses without transfers for over an hour . @param tenantId the tenant for which to search . @return List of zombie Job ids
@SuppressWarnings("unchecked")
	public static List<BigInteger> findZombieJobs(String tenantId) 
	throws JobException
	{
		boolean excludeTenant = false;
	    if (StringUtils.isEmpty(tenantId)) {
            tenantId = "%";
        } else if (tenantId.contains("!")) {
            excludeTenant = true;
            tenantId = StringUtils.removeStart(tenantId, "!");
        }
		Session session = null;
		try
		{
			HibernateUtil.beginTransaction();
			session = getSession();
			session.clear();
			session.disableFilter("jobTenantFilter");
			String sql ="SELECT j.id " + 
						"FROM jobs j " +
						"WHERE j.status in ('PROCESSING_INPUTS', 'STAGING_INPUTS', 'STAGING_JOB', 'SUBMITTING_JOB', 'SUBMITTING', 'ARCHIVING')  " + 
						"	   AND NOW() > DATE_ADD(j.last_updated, INTERVAL 45 minute) " +  
						"	   AND j.visible = 1 " + 
						"	   AND j.tenant_id :excludetenant like :tenantId " + 
						"ORDER BY j.last_updated ASC ";
			sql = StringUtils.replace(sql, ":excludetenant", excludeTenant ? "not" : "");
			List<BigInteger> jobIds = session.createSQLQuery(sql)
					.setCacheable(false)
					.setCacheMode(CacheMode.IGNORE)
					.setString("tenantId", tenantId)
					.list();
			return jobIds;
		} catch (StaleObjectStateException e) {
			return null;
		} catch (Throwable e) {
			throw new JobException("Failed to retrieve zombie archiving jobs", e);
		} finally {
			try {
				HibernateUtil.commitTransaction();
			} catch (Exception ignored) {
			}
		}
	}
@ SuppressWarnings ( "unchecked" ) public static List < BigInteger > findZombieJobs ( String tenantId ) throws JobException { boolean excludeTenant = false ; if ( StringUtils . isEmpty ( tenantId ) ) { tenantId = "%" ; } else if ( tenantId . contains ( "!" ) ) { excludeTenant = true ; tenantId = StringUtils . removeStart ( tenantId , "!" ) ; } Session session = null ; try { HibernateUtil . beginTransaction ( ) ; session = getSession ( ) ; session . clear ( ) ; session . disableFilter ( "jobTenantFilter" ) ; String sql = "SELECT j.id " + "FROM jobs j " + "WHERE j.status in ('PROCESSING_INPUTS', 'STAGING_INPUTS', 'STAGING_JOB', 'SUBMITTING_JOB', 'SUBMITTING', 'ARCHIVING')  " + "	   AND NOW() > DATE_ADD(j.last_updated, INTERVAL 45 minute) " + "	   AND j.visible = 1 " + "	   AND j.tenant_id :excludetenant like :tenantId " + "ORDER BY j.last_updated ASC " ; sql = StringUtils . replace ( sql , ":excludetenant" , excludeTenant ? "not" : "" ) ; List < BigInteger > jobIds = session . createSQLQuery ( sql ) . setCacheable ( false ) . setCacheMode ( CacheMode . IGNORE ) . setString ( "tenantId" , tenantId ) . list ( ) ; return jobIds ; } catch ( StaleObjectStateException e ) { return null ; } catch ( Throwable e ) { throw new JobException ( "Failed to retrieve zombie archiving jobs" , e ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Returns all zombie jobs which have active transfers that have not been
 updated in the last 15 minutes or which have been in intermediate
 statuses without transfers for over an hour.
Returns all zombie jobs which have active transfers that have not been updated in the last 15 minutes or which have been in intermediate statuses without transfers for over an hour .
// unable to perform the query due to stale data. return null and try again later