Package org.quartz.utils

Examples of org.quartz.utils.TriggerStatus


            String triggerName, String groupName) throws SQLException {
        PreparedStatement ps = null;
        ResultSet rs = null;

        try {
            TriggerStatus status = null;

            ps = conn.prepareStatement(rtp(SELECT_TRIGGER_STATUS));
            ps.setString(1, triggerName);
            ps.setString(2, groupName);
            rs = ps.executeQuery();

            if (rs.next()) {
                String state = rs.getString(COL_TRIGGER_STATE);
                long nextFireTime = rs.getLong(COL_NEXT_FIRE_TIME);
                String jobName = rs.getString(COL_JOB_NAME);
                String jobGroup = rs.getString(COL_JOB_GROUP);

                Date nft = null;
                if (nextFireTime > 0) {
                    nft = new Date(nextFireTime);
                }

                status = new TriggerStatus(state, nft);
                status.setKey(new Key(triggerName, groupName));
                status.setJobKey(new Key(jobName, jobGroup));
            }

            return status;
        } finally {
            closeResultSet(rs);
View Full Code Here


    public void resumeTrigger(Connection conn, SchedulingContext ctxt,
            String triggerName, String groupName)
        throws JobPersistenceException {
        try {

            TriggerStatus status = getDelegate().selectTriggerStatus(conn,
                    triggerName, groupName);

            if (status == null || status.getNextFireTime() == null) {
                return;
            }

            boolean blocked = false;
            if(STATE_PAUSED_BLOCKED.equals(status.getStatus())) {
                blocked = true;
            }

            String newState = checkBlockedState(conn, ctxt, status.getJobKey().getName(),
                    status.getJobKey().getGroup(), STATE_WAITING);

            boolean misfired = false;

            if (status.getNextFireTime().before(new Date())) {
                misfired = updateMisfiredTrigger(conn, ctxt, triggerName, groupName,
                    newState, true);
            }

            if(!misfired) {
View Full Code Here

        try {
            if (triggerInstCode == Trigger.INSTRUCTION_DELETE_TRIGGER) {
                if(trigger.getNextFireTime() == null) {
                    // double check for possible reschedule within job
                    // execution, which would cancel the need to delete...
                    TriggerStatus stat = getDelegate().selectTriggerStatus(
                            conn, trigger.getName(), trigger.getGroup());
                    if(stat != null && stat.getNextFireTime() == null) {
                        removeTrigger(conn, ctxt, trigger.getName(), trigger.getGroup());
                    }
                } else{
                    removeTrigger(conn, ctxt, trigger.getName(), trigger.getGroup());
                    signaler.signalSchedulingChange(0L);
View Full Code Here

/*      */   {
/* 2624 */     PreparedStatement ps = null;
/* 2625 */     ResultSet rs = null;
/*      */     try
/*      */     {
/* 2628 */       TriggerStatus status = null;
/*      */
/* 2630 */       ps = conn.prepareStatement(rtp("SELECT TRIGGER_STATE, NEXT_FIRE_TIME, JOB_NAME, JOB_GROUP FROM {0}TRIGGERS WHERE TRIGGER_NAME = ? AND TRIGGER_GROUP = ?"));
/* 2631 */       ps.setString(1, triggerName);
/* 2632 */       ps.setString(2, groupName);
/* 2633 */       rs = ps.executeQuery();
/*      */
/* 2635 */       if (rs.next()) {
/* 2636 */         state = rs.getString("TRIGGER_STATE");
/* 2637 */         long nextFireTime = rs.getLong("NEXT_FIRE_TIME");
/* 2638 */         String jobName = rs.getString("JOB_NAME");
/* 2639 */         String jobGroup = rs.getString("JOB_GROUP");
/*      */
/* 2641 */         Date nft = null;
/* 2642 */         if (nextFireTime > 0L) {
/* 2643 */           nft = new Date(nextFireTime);
/*      */         }
/*      */
/* 2646 */         status = new TriggerStatus(state, nft);
/* 2647 */         status.setKey(new Key(triggerName, groupName));
/* 2648 */         status.setJobKey(new Key(jobName, jobGroup));
/*      */       }
/*      */
/* 2651 */       state = status;
/*      */     }
/*      */     finally
View Full Code Here

/*      */   public void resumeTrigger(Connection conn, SchedulingContext ctxt, String triggerName, String groupName)
/*      */     throws JobPersistenceException
/*      */   {
/*      */     try
/*      */     {
/* 1510 */       TriggerStatus status = getDelegate().selectTriggerStatus(conn, triggerName, groupName);
/*      */
/* 1513 */       if ((status == null) || (status.getNextFireTime() == null)) return;
/*      */
/* 1515 */       boolean blocked = false;
/* 1516 */       if ("PAUSED_BLOCKED".equals(status.getStatus())) {
/* 1517 */         blocked = true;
/*      */       }
/* 1519 */       String newState = getStatusForResumedTrigger(conn, ctxt, status);
/*      */
/* 1521 */       boolean misfired = false;
/*      */
/* 1523 */       if (status.getNextFireTime().before(new Date())) {
/* 1524 */         misfired = updateMisfiredTrigger(conn, ctxt, triggerName, groupName, newState, true);
/*      */       }
/*      */
/* 1528 */       if (!misfired) {
/* 1529 */         if (blocked) {
View Full Code Here

/*      */     try
/*      */     {
/* 1889 */       if (triggerInstCode == 3) {
/* 1890 */         if (trigger.getNextFireTime() == null)
/*      */         {
/* 1893 */           TriggerStatus stat = getDelegate().selectTriggerStatus(conn, trigger.getName(), trigger.getGroup());
/*      */
/* 1895 */           if ((stat != null) && (stat.getNextFireTime() == null))
/* 1896 */             removeTrigger(conn, ctxt, trigger.getName(), trigger.getGroup());
/*      */         }
/*      */         else
/*      */         {
/* 1900 */           removeTrigger(conn, ctxt, trigger.getName(), trigger.getGroup());
View Full Code Here

    public void resumeTrigger(Connection conn, SchedulingContext ctxt,
            String triggerName, String groupName)
            throws JobPersistenceException {
        try {

            TriggerStatus status = getDelegate().selectTriggerStatus(conn,
                    triggerName, groupName);

            if (status == null || status.getNextFireTime() == null) return;

            boolean blocked = false;
            if(STATE_PAUSED_BLOCKED.equals(status.getStatus()))
                blocked = true;

            String newState = getStatusForResumedTrigger(conn, ctxt, status);

            boolean misfired = false;

            if (status.getNextFireTime().before(new Date())) {
              misfired = updateMisfiredTrigger(conn, ctxt, triggerName, groupName,
                  newState, true);
            }

            if(!misfired) {
View Full Code Here

        try {
            if (triggerInstCode == Trigger.INSTRUCTION_DELETE_TRIGGER) {
                if(trigger.getNextFireTime() == null) {
                    // double check for possible reschedule within job
                    // execution, which would cancel the need to delete...
                    TriggerStatus stat = getDelegate().selectTriggerStatus(
                            conn, trigger.getName(), trigger.getGroup());
                    if(stat != null && stat.getNextFireTime() == null) {
                        removeTrigger(conn, ctxt, trigger.getName(), trigger.getGroup());
                    }
                }
                else{
                    removeTrigger(conn, ctxt, trigger.getName(), trigger.getGroup());
View Full Code Here

            String triggerName, String groupName) throws SQLException {
        PreparedStatement ps = null;
        ResultSet rs = null;

        try {
            TriggerStatus status = null;

            ps = conn.prepareStatement(rtp(SELECT_TRIGGER_STATUS.toLowerCase()));
            ps.setString(1, triggerName);
            ps.setString(2, groupName);
            rs = ps.executeQuery();

            if (rs.next()) {
                String state = rs.getString(COL_TRIGGER_STATE.toLowerCase());
                long nextFireTime = rs.getLong(COL_NEXT_FIRE_TIME.toLowerCase());
                String jobName = rs.getString(COL_JOB_NAME.toLowerCase());
                String jobGroup = rs.getString(COL_JOB_GROUP.toLowerCase());

                Date nft = null;
                if (nextFireTime > 0) {
                    nft = new Date(nextFireTime);
                }

                status = new TriggerStatus(state, nft);
                status.setKey(new Key(triggerName, groupName));
                status.setJobKey(new Key(jobName, jobGroup));
            }

            return status;
        } finally {
            closeResultSet(rs);
View Full Code Here

            String triggerName, String groupName) throws SQLException {
        PreparedStatement ps = null;
        ResultSet rs = null;

        try {
            TriggerStatus status = null;

            ps = conn.prepareStatement(rtp(SELECT_TRIGGER_STATUS));
            ps.setString(1, triggerName);
            ps.setString(2, groupName);
            rs = ps.executeQuery();

            if (rs.next()) {
                String state = rs.getString(COL_TRIGGER_STATE);
                long nextFireTime = rs.getLong(COL_NEXT_FIRE_TIME);
                String jobName = rs.getString(COL_JOB_NAME);
                String jobGroup = rs.getString(COL_JOB_GROUP);

                Date nft = null;
                if (nextFireTime > 0) {
                    nft = new Date(nextFireTime);
                }

                status = new TriggerStatus(state, nft);
                status.setKey(new Key(triggerName, groupName));
                status.setJobKey(new Key(jobName, jobGroup));
            }

            return status;
        } finally {
            closeResultSet(rs);
View Full Code Here

TOP

Related Classes of org.quartz.utils.TriggerStatus

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.