Java Code Examples for org.quartz.Trigger.TriggerState#BLOCKED

The following examples show how to use org.quartz.Trigger.TriggerState#BLOCKED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractQuartzTaskManager.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
private TaskState triggerStateToTaskState(TriggerState triggerState) {
    if (triggerState == TriggerState.NONE) {
        return TaskState.NONE;
    } else if (triggerState == TriggerState.PAUSED) {
        return TaskState.PAUSED;
    } else if (triggerState == TriggerState.COMPLETE) {
        return TaskState.FINISHED;
    } else if (triggerState == TriggerState.ERROR) {
        return TaskState.ERROR;
    } else if (triggerState == TriggerState.NORMAL) {
        return TaskState.NORMAL;
    } else if (triggerState == TriggerState.BLOCKED) {
        return TaskState.BLOCKED;
    } else {
        return TaskState.UNKNOWN;
    }
}
 
Example 2
Source File: RedisJobStore.java    From redis-quartz with MIT License 6 votes vote down vote up
@Override
public TriggerState getTriggerState(TriggerKey triggerKey)
		throws JobPersistenceException {
	String triggerHashKey = createTriggerHashKey(triggerKey.getGroup(), triggerKey.getName());
     try (Jedis jedis = pool.getResource()) {
        lockPool.acquire();
		
		if (jedis.zscore(RedisTriggerState.PAUSED.getKey(), triggerHashKey) != null || jedis.zscore(RedisTriggerState.PAUSED_BLOCKED.getKey(), triggerHashKey)!= null)
			return TriggerState.PAUSED;
		else if (jedis.zscore(RedisTriggerState.BLOCKED.getKey(), triggerHashKey) != null)
			return TriggerState.BLOCKED;
		else if (jedis.zscore(RedisTriggerState.WAITING.getKey(), triggerHashKey) != null || jedis.zscore(RedisTriggerState.ACQUIRED.getKey(), triggerHashKey) != null)
			return TriggerState.NORMAL;
		else if (jedis.zscore(RedisTriggerState.COMPLETED.getKey(), triggerHashKey) != null)
			return TriggerState.COMPLETE;
		else if (jedis.zscore(RedisTriggerState.ERROR.getKey(), triggerHashKey) != null)
			return TriggerState.ERROR;
		else
			return TriggerState.NONE;
	} catch (Exception ex) {
		log.error("could not get trigger state: " + triggerHashKey, ex);
		throw new JobPersistenceException(ex.getMessage(), ex.getCause());
	} finally {
        lockPool.release();
	}
}
 
Example 3
Source File: AbstractQuartzTaskManager.java    From carbon-commons with Apache License 2.0 6 votes vote down vote up
private TaskState triggerStateToTaskState(TriggerState triggerState) {
    if (triggerState == TriggerState.NONE) {
        return TaskState.NONE;
    } else if (triggerState == TriggerState.PAUSED) {
        return TaskState.PAUSED;
    } else if (triggerState == TriggerState.COMPLETE) {
        return TaskState.FINISHED;
    } else if (triggerState == TriggerState.ERROR) {
        return TaskState.ERROR;
    } else if (triggerState == TriggerState.NORMAL) {
        return TaskState.NORMAL;
    } else if (triggerState == TriggerState.BLOCKED) {
        return TaskState.BLOCKED;
    } else {
        return TaskState.UNKNOWN;
    }
}
 
Example 4
Source File: RAMJobStore.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * <p>
 * Get the current state of the identified <code>{@link Trigger}</code>.
 * </p>
 *
 * @see TriggerState#NORMAL
 * @see TriggerState#PAUSED
 * @see TriggerState#COMPLETE
 * @see TriggerState#ERROR
 * @see TriggerState#BLOCKED
 * @see TriggerState#NONE
 */
public TriggerState getTriggerState(TriggerKey triggerKey) throws JobPersistenceException {
    synchronized(lock) {
        TriggerWrapper tw = triggersByKey.get(triggerKey);
        
        if (tw == null) {
            return TriggerState.NONE;
        }

        if (tw.state == TriggerWrapper.STATE_COMPLETE) {
            return TriggerState.COMPLETE;
        }

        if (tw.state == TriggerWrapper.STATE_PAUSED) {
            return TriggerState.PAUSED;
        }

        if (tw.state == TriggerWrapper.STATE_PAUSED_BLOCKED) {
            return TriggerState.PAUSED;
        }

        if (tw.state == TriggerWrapper.STATE_BLOCKED) {
            return TriggerState.BLOCKED;
        }

        if (tw.state == TriggerWrapper.STATE_ERROR) {
            return TriggerState.ERROR;
        }

        return TriggerState.NORMAL;
    }
}
 
Example 5
Source File: JobStoreSupport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public TriggerState getTriggerState(Connection conn, TriggerKey key)
    throws JobPersistenceException {
    try {
        String ts = getDelegate().selectTriggerState(conn, key);

        if (ts == null) {
            return TriggerState.NONE;
        }

        if (ts.equals(STATE_DELETED)) {
            return TriggerState.NONE;
        }

        if (ts.equals(STATE_COMPLETE)) {
            return TriggerState.COMPLETE;
        }

        if (ts.equals(STATE_PAUSED)) {
            return TriggerState.PAUSED;
        }

        if (ts.equals(STATE_PAUSED_BLOCKED)) {
            return TriggerState.PAUSED;
        }

        if (ts.equals(STATE_ERROR)) {
            return TriggerState.ERROR;
        }

        if (ts.equals(STATE_BLOCKED)) {
            return TriggerState.BLOCKED;
        }

        return TriggerState.NORMAL;

    } catch (SQLException e) {
        throw new JobPersistenceException(
                "Couldn't determine state of trigger (" + key + "): " + e.getMessage(), e);
    }
}