当前位置: 首页>>代码示例>>Java>>正文


Java JobPersistenceException类代码示例

本文整理汇总了Java中org.quartz.JobPersistenceException的典型用法代码示例。如果您正苦于以下问题:Java JobPersistenceException类的具体用法?Java JobPersistenceException怎么用?Java JobPersistenceException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JobPersistenceException类属于org.quartz包,在下文中一共展示了JobPersistenceException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clusterCheckIn

import org.quartz.JobPersistenceException; //导入依赖的package包/类
protected List<SchedulerStateRecord> clusterCheckIn(Connection conn)
    throws JobPersistenceException {

    List<SchedulerStateRecord> failedInstances = findFailedInstances(conn);
    
    try {
        // FUTURE_TODO: handle self-failed-out

        // check in...
        lastCheckin = System.currentTimeMillis();
        if(getDelegate().updateSchedulerState(conn, getInstanceId(), lastCheckin) == 0) {
            getDelegate().insertSchedulerState(conn, getInstanceId(),
                    lastCheckin, getClusterCheckinInterval());
        }
        
    } catch (Exception e) {
        throw new JobPersistenceException("Failure updating scheduler state when checking-in: "
                + e.getMessage(), e);
    }

    return failedInstances;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:JobStoreSupport.java

示例2: pauseJobs

import org.quartz.JobPersistenceException; //导入依赖的package包/类
/**
 * <p>
 * Pause all of the <code>{@link org.quartz.Job}s</code> matching the given
 * groupMatcher - by pausing all of their <code>Trigger</code>s.
 * </p>
 * 
 * @see #resumeJobs(org.quartz.impl.matchers.GroupMatcher)
 */
@SuppressWarnings("unchecked")
public Set<String> pauseJobs(final GroupMatcher<JobKey> matcher)
    throws JobPersistenceException {
    return (Set<String>) executeInLock(
        LOCK_TRIGGER_ACCESS,
        new TransactionCallback() {
            public Set<String> execute(final Connection conn) throws JobPersistenceException {
                Set<String> groupNames = new HashSet<String>();
                Set<JobKey> jobNames = getJobNames(conn, matcher);

                for (JobKey jobKey : jobNames) {
                    List<OperableTrigger> triggers = getTriggersForJob(conn, jobKey);
                    for (OperableTrigger trigger : triggers) {
                        pauseTrigger(conn, trigger.getKey());
                    }
                    groupNames.add(jobKey.getGroup());
                }

                return groupNames;
            }
        }
        );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:JobStoreSupport.java

示例3: getTriggerState

import org.quartz.JobPersistenceException; //导入依赖的package包/类
/**
 * <p>
 * Get the current state of the identified <code>{@link Trigger}</code>.
 * </p>
 *
 * @see Trigger#STATE_NORMAL
 * @see Trigger#STATE_PAUSED
 * @see Trigger#STATE_COMPLETE
 * @see Trigger#STATE_ERROR
 * @see Trigger#STATE_BLOCKED
 * @see Trigger#STATE_NONE
 */
public int getTriggerState(SchedulingContext ctxt, String triggerName,
        String groupName) throws JobPersistenceException {
    synchronized(lock) {
        TriggerWrapper tw = (TriggerWrapper) triggersByFQN.get(TriggerWrapper
            .getTriggerNameKey(triggerName, groupName));
        
        if (tw == null) {
            return Trigger.STATE_NONE;
        }

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

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

        if (tw.state == TriggerWrapper.STATE_PAUSED_BLOCKED) {
            return Trigger.STATE_PAUSED;
        }

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

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

        return Trigger.STATE_NORMAL;
    }
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:46,代码来源:RAMJobStore.java

示例4: doUpdateOfMisfiredTrigger

import org.quartz.JobPersistenceException; //导入依赖的package包/类
private void doUpdateOfMisfiredTrigger(Connection conn, SchedulingContext ctxt, Trigger trig, boolean forceState, String newStateIfNotComplete, boolean recovering) throws JobPersistenceException {
    Calendar cal = null;
    if (trig.getCalendarName() != null) {
        cal = retrieveCalendar(conn, ctxt, trig.getCalendarName());
    }

    schedSignaler.notifyTriggerListenersMisfired(trig);

    trig.updateAfterMisfire(cal);

    if (trig.getNextFireTime() == null) {
        storeTrigger(conn, ctxt, trig,
            null, true, STATE_COMPLETE, forceState, recovering);
    } else {
        storeTrigger(conn, ctxt, trig, null, true, newStateIfNotComplete,
                forceState, false);
    }
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:19,代码来源:JobStoreSupport.java

示例5: retrieveTrigger

import org.quartz.JobPersistenceException; //导入依赖的package包/类
protected Trigger retrieveTrigger(Connection conn, String triggerName, String groupName)
    throws JobPersistenceException {
    try {
        Trigger trigger = getDelegate().selectTrigger(conn, triggerName,
                groupName);
        if (trigger == null) {
            return null;
        }
        
        // In case Trigger was BLOB, clear out any listeners that might 
        // have been serialized.
        trigger.clearAllTriggerListeners();
        
        String[] listeners = getDelegate().selectTriggerListeners(conn,
                triggerName, groupName);
        for (int i = 0; i < listeners.length; ++i) {
            trigger.addTriggerListener(listeners[i]);
        }

        return trigger;
    } catch (Exception e) {
        throw new JobPersistenceException("Couldn't retrieve trigger: "
                + e.getMessage(), e);
    }
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:26,代码来源:JobStoreSupport.java

示例6: pauseTrigger

import org.quartz.JobPersistenceException; //导入依赖的package包/类
/**
 * <p>
 * Pause the <code>{@link org.quartz.Trigger}</code> with the given name.
 * </p>
 * 
 * @see #resumeTrigger(Connection, SchedulingContext, String, String)
 */
public void pauseTrigger(Connection conn, SchedulingContext ctxt,
        String triggerName, String groupName)
    throws JobPersistenceException {

    try {
        String oldState = getDelegate().selectTriggerState(conn,
                triggerName, groupName);

        if (oldState.equals(STATE_WAITING)
                || oldState.equals(STATE_ACQUIRED)) {

            getDelegate().updateTriggerState(conn, triggerName,
                    groupName, STATE_PAUSED);
        } else if (oldState.equals(STATE_BLOCKED)) {
            getDelegate().updateTriggerState(conn, triggerName,
                    groupName, STATE_PAUSED_BLOCKED);
        }
    } catch (SQLException e) {
        throw new JobPersistenceException("Couldn't pause trigger '"
                + groupName + "." + triggerName + "': " + e.getMessage(), e);
    }
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:30,代码来源:JobStoreSupport.java

示例7: storeJobsAndTriggers

import org.quartz.JobPersistenceException; //导入依赖的package包/类
public void storeJobsAndTriggers(
        final Map<JobDetail, Set<? extends Trigger>> triggersAndJobs, final boolean replace)
        throws JobPersistenceException {

    executeInLock(
            (isLockOnInsert() || replace) ? LOCK_TRIGGER_ACCESS : null,
            new VoidTransactionCallback() {
                public void executeVoid(Connection conn) throws JobPersistenceException {
                    
                    // FUTURE_TODO: make this more efficient with a true bulk operation...
                    for(JobDetail job: triggersAndJobs.keySet()) {
                        storeJob(conn, job, replace);
                        for(Trigger trigger: triggersAndJobs.get(job)) {
                            storeTrigger(conn, (OperableTrigger) trigger, job, replace,
                                    Constants.STATE_WAITING, false, false);
                        }
                    }
                }
            });
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:JobStoreSupport.java

示例8: resumeJobs

import org.quartz.JobPersistenceException; //导入依赖的package包/类
/**
 * <p>
 * Resume (un-pause) all of the <code>{@link org.quartz.JobDetail}s</code> in the given group.
 * </p>
 * <p>
 * If any of the <code>Job</code> s had <code>Trigger</code> s that missed one or more fire-times, then the
 * <code>Trigger</code>'s misfire instruction will be applied.
 * </p>
 */
@Override
public Collection<String> resumeJobs(GroupMatcher<JobKey> matcher) throws JobPersistenceException {
  Collection<String> groups = new HashSet<String>();
  lock();
  try {
    Set<JobKey> jobKeys = getJobKeys(matcher);

    for (JobKey jobKey : jobKeys) {
      if (groups.add(jobKey.getGroup())) {
        jobFacade.removePausedJobGroup(jobKey.getGroup());
      }
      for (OperableTrigger trigger : getTriggersForJob(jobKey)) {
        resumeTrigger(trigger.getKey());
      }
    }
  } finally {
    unlock();
  }
  return groups;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:DefaultClusteredJobStore.java

示例9: applyMisfire

import org.quartz.JobPersistenceException; //导入依赖的package包/类
boolean applyMisfire(TriggerWrapper tw) throws JobPersistenceException {
  long misfireTime = System.currentTimeMillis();
  if (getMisfireThreshold() > 0) {
    misfireTime -= getMisfireThreshold();
  }

  Date tnft = tw.getNextFireTime();
  if (tnft == null || tnft.getTime() > misfireTime
      || tw.getMisfireInstruction() == Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY) { return false; }

  Calendar cal = null;
  if (tw.getCalendarName() != null) {
    cal = retrieveCalendar(tw.getCalendarName());
  }

  signaler.notifyTriggerListenersMisfired(tw.getTriggerClone());

  tw.updateAfterMisfire(cal, triggerFacade);

  if (tw.getNextFireTime() == null) {
    tw.setState(TriggerState.COMPLETE, terracottaClientId, triggerFacade);
    signaler.notifySchedulerListenersFinalized(tw.getTriggerClone());
    timeTriggers.remove(tw);
  } else if (tnft.equals(tw.getNextFireTime())) { return false; }

  return true;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:DefaultClusteredJobStore.java

示例10: pauseAll

import org.quartz.JobPersistenceException; //导入依赖的package包/类
/**
 * <p>
 * Pause all triggers - equivalent of calling <code>pauseTriggerGroup(group)</code>
 * on every group.
 * </p>
 * 
 * <p>
 * When <code>resumeAll()</code> is called (to un-pause), trigger misfire
 * instructions WILL be applied.
 * </p>
 * 
 * @see #resumeAll(Connection)
 * @see #pauseTriggerGroup(java.sql.Connection, org.quartz.impl.matchers.GroupMatcher)
 */
public void pauseAll(Connection conn)
    throws JobPersistenceException {

    List<String> names = getTriggerGroupNames(conn);

    for (String name: names) {
        pauseTriggerGroup(conn, GroupMatcher.triggerGroupEquals(name));
    }

    try {
        if (!getDelegate().isTriggerGroupPaused(conn, ALL_GROUPS_PAUSED)) {
            getDelegate().insertPausedTriggerGroup(conn, ALL_GROUPS_PAUSED);
        }

    } catch (SQLException e) {
        throw new JobPersistenceException(
                "Couldn't pause all trigger groups: " + e.getMessage(), e);
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:JobStoreSupport.java

示例11: removeJob

import org.quartz.JobPersistenceException; //导入依赖的package包/类
protected boolean removeJob(Connection conn, SchedulingContext ctxt,
        String jobName, String groupName, boolean activeDeleteSafe)
    throws JobPersistenceException {

    try {
        Key[] jobTriggers = getDelegate().selectTriggerNamesForJob(conn,
                jobName, groupName);
        for (int i = 0; i < jobTriggers.length; ++i) {
            deleteTriggerAndChildren(
                conn, jobTriggers[i].getName(), jobTriggers[i].getGroup());
        }

        return deleteJobAndChildren(conn, ctxt, jobName, groupName);
    } catch (SQLException e) {
        throw new JobPersistenceException("Couldn't remove job: "
                + e.getMessage(), e);
    }
}
 
开发者ID:AsuraTeam,项目名称:asura,代码行数:19,代码来源:JobStoreSupport.java

示例12: acquireNextTriggers

import org.quartz.JobPersistenceException; //导入依赖的package包/类
@Override
public List<OperableTrigger> acquireNextTriggers(long noLaterThan, int maxCount, long timeWindow)
    throws JobPersistenceException {
  try {
    return realJobStore.acquireNextTriggers(noLaterThan, maxCount, timeWindow);
  } catch (RejoinException e) {
    throw new JobPersistenceException("Trigger acquisition failed due to client rejoin", e);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:AbstractTerracottaJobStore.java

示例13: getJobGroupNames

import org.quartz.JobPersistenceException; //导入依赖的package包/类
@Override
public List<String> getJobGroupNames() throws JobPersistenceException {
  try {
    return realJobStore.getJobGroupNames();
  } catch (RejoinException e) {
    throw new JobPersistenceException("Job name retrieval failed due to client rejoin", e);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:AbstractTerracottaJobStore.java

示例14: getJobKeys

import org.quartz.JobPersistenceException; //导入依赖的package包/类
@Override
public Set<JobKey> getJobKeys(GroupMatcher<JobKey> matcher) throws JobPersistenceException {
  try {
    return realJobStore.getJobKeys(matcher);
  } catch (RejoinException e) {
    throw new JobPersistenceException("Job key retrieval failed due to client rejoin", e);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:AbstractTerracottaJobStore.java

示例15: getNumberOfCalendars

import org.quartz.JobPersistenceException; //导入依赖的package包/类
@Override
public int getNumberOfCalendars() throws JobPersistenceException {
  try {
    return realJobStore.getNumberOfCalendars();
  } catch (RejoinException e) {
    throw new JobPersistenceException("Calendar count retrieval failed due to client rejoin", e);
  }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:AbstractTerracottaJobStore.java


注:本文中的org.quartz.JobPersistenceException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。