亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ramjobstore.java

?? Java中非常實用流控制工具
?? JAVA
?? 第 1 頁 / 共 4 頁
字號:
/* 
 * Copyright 2004-2005 OpenSymphony 
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
 * use this file except in compliance with the License. You may obtain a copy 
 * of the License at 
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0 
 *   
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
 * License for the specific language governing permissions and limitations 
 * under the License.
 * 
 */

/*
 * Previously Copyright (c) 2001-2004 James House
 */
package org.quartz.simpl;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Calendar;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.JobPersistenceException;
import org.quartz.ObjectAlreadyExistsException;
import org.quartz.SchedulerException;
import org.quartz.Trigger;
import org.quartz.core.SchedulingContext;
import org.quartz.spi.ClassLoadHelper;
import org.quartz.spi.JobStore;
import org.quartz.spi.SchedulerSignaler;
import org.quartz.spi.TriggerFiredBundle;

/**
 * <p>
 * This class implements a <code>{@link org.quartz.spi.JobStore}</code> that
 * utilizes RAM as its storage device.
 * </p>
 * 
 * <p>
 * As you should know, the ramification of this is that access is extrememly
 * fast, but the data is completely volatile - therefore this <code>JobStore</code>
 * should not be used if true persistence between program shutdowns is
 * required.
 * </p>
 * 
 * @author James House
 * @author Sharada Jambula
 * @author Eric Mueller
 */
public class RAMJobStore implements JobStore {

    /*
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * 
     * Data members.
     * 
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     */

    protected HashMap jobsByFQN = new HashMap(1000);

    protected HashMap triggersByFQN = new HashMap(1000);

    protected HashMap jobsByGroup = new HashMap(25);

    protected HashMap triggersByGroup = new HashMap(25);

    protected TreeSet timeTriggers = new TreeSet(new TriggerComparator());

    protected HashMap calendarsByName = new HashMap(25);

    protected ArrayList triggers = new ArrayList(1000);

    protected final Object triggerLock = new Object();

    protected HashSet pausedTriggerGroups = new HashSet();

    protected HashSet pausedJobGroups = new HashSet();

    protected HashSet blockedJobs = new HashSet();
    
    protected long misfireThreshold = 5000l;

    protected SchedulerSignaler signaler;

    private final Log log = LogFactory.getLog(getClass());

    /*
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * 
     * Constructors.
     * 
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     */

    /**
     * <p>
     * Create a new <code>RAMJobStore</code>.
     * </p>
     */
    public RAMJobStore() {
    }

    /*
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     * 
     * Interface.
     * 
     * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     */

    protected Log getLog() {
        return log;
    }

    /**
     * <p>
     * Called by the QuartzScheduler before the <code>JobStore</code> is
     * used, in order to give the it a chance to initialize.
     * </p>
     */
    public void initialize(ClassLoadHelper loadHelper,
            SchedulerSignaler signaler) {

        this.signaler = signaler;

        getLog().info("RAMJobStore initialized.");
    }

    public void schedulerStarted() throws SchedulerException {
        // nothing to do
    }

    public long getMisfireThreshold() {
        return misfireThreshold;
    }

    /**
     * The number of milliseconds by which a trigger must have missed its
     * next-fire-time, in order for it to be considered "misfired" and thus
     * have its misfire instruction applied.
     * 
     * @param misfireThreshold
     */
    public void setMisfireThreshold(long misfireThreshold) {
        if (misfireThreshold < 1) {
            throw new IllegalArgumentException("Misfirethreashold must be larger than 0");
        }
        this.misfireThreshold = misfireThreshold;
    }

    /**
     * <p>
     * Called by the QuartzScheduler to inform the <code>JobStore</code> that
     * it should free up all of it's resources because the scheduler is
     * shutting down.
     * </p>
     */
    public void shutdown() {
    }

    public boolean supportsPersistence() {
        return false;
    }

    /**
     * <p>
     * Store the given <code>{@link org.quartz.JobDetail}</code> and <code>{@link org.quartz.Trigger}</code>.
     * </p>
     * 
     * @param newJob
     *          The <code>JobDetail</code> to be stored.
     * @param newTrigger
     *          The <code>Trigger</code> to be stored.
     * @throws ObjectAlreadyExistsException
     *           if a <code>Job</code> with the same name/group already
     *           exists.
     */
    public void storeJobAndTrigger(SchedulingContext ctxt, JobDetail newJob,
            Trigger newTrigger) throws JobPersistenceException {
        storeJob(ctxt, newJob, false);
        storeTrigger(ctxt, newTrigger, false);
    }

    /**
     * <p>
     * Store the given <code>{@link org.quartz.Job}</code>.
     * </p>
     * 
     * @param newJob
     *          The <code>Job</code> to be stored.
     * @param replaceExisting
     *          If <code>true</code>, any <code>Job</code> existing in the
     *          <code>JobStore</code> with the same name & group should be
     *          over-written.
     * @throws ObjectAlreadyExistsException
     *           if a <code>Job</code> with the same name/group already
     *           exists, and replaceExisting is set to false.
     */
    public void storeJob(SchedulingContext ctxt, JobDetail newJob,
            boolean replaceExisting) throws ObjectAlreadyExistsException {
        JobWrapper jw = new JobWrapper((JobDetail)newJob.clone());

        boolean repl = false;

        if (jobsByFQN.get(jw.key) != null) {
            if (!replaceExisting) {
                throw new ObjectAlreadyExistsException(newJob);
            }
            repl = true;
        }

        synchronized (triggerLock) {
            if (!repl) {
                // get job group
                HashMap grpMap = (HashMap) jobsByGroup.get(newJob.getGroup());
                if (grpMap == null) {
                    grpMap = new HashMap(100);
                    jobsByGroup.put(newJob.getGroup(), grpMap);
                }
                // add to jobs by group
                grpMap.put(newJob.getName(), jw);
                // add to jobs by FQN map
                jobsByFQN.put(jw.key, jw);
            } else {
                // update job detail
                JobWrapper orig = (JobWrapper) jobsByFQN.get(jw.key);
                orig.jobDetail = jw.jobDetail; // already cloned
            }
        }
    }

    /**
     * <p>
     * Remove (delete) the <code>{@link org.quartz.Job}</code> with the given
     * name, and any <code>{@link org.quartz.Trigger}</code> s that reference
     * it.
     * </p>
     *
     * @param jobName
     *          The name of the <code>Job</code> to be removed.
     * @param groupName
     *          The group name of the <code>Job</code> to be removed.
     * @return <code>true</code> if a <code>Job</code> with the given name &
     *         group was found and removed from the store.
     */
    public boolean removeJob(SchedulingContext ctxt, String jobName,
            String groupName) {
        String key = JobWrapper.getJobNameKey(jobName, groupName);

        boolean found = false;

        Trigger[] trigger = getTriggersForJob(ctxt, jobName,
                groupName);
        for (int i = 0; i < trigger.length; i++) {
            Trigger trig = trigger[i];
            this.removeTrigger(ctxt, trig.getName(), trig.getGroup());
            found = true;
        }
        synchronized (triggerLock) {
            found = (jobsByFQN.remove(key) != null) | found;
            if (found) {

                HashMap grpMap = (HashMap) jobsByGroup.get(groupName);
                if (grpMap != null) {
                    grpMap.remove(jobName);
                    if (grpMap.size() == 0) {
                        jobsByGroup.remove(groupName);
                    }
                }
            }
        }

        return found;
    }

    /**
     * <p>
     * Store the given <code>{@link org.quartz.Trigger}</code>.
     * </p>
     *
     * @param newTrigger
     *          The <code>Trigger</code> to be stored.
     * @param replaceExisting
     *          If <code>true</code>, any <code>Trigger</code> existing in
     *          the <code>JobStore</code> with the same name & group should
     *          be over-written.
     * @throws ObjectAlreadyExistsException
     *           if a <code>Trigger</code> with the same name/group already
     *           exists, and replaceExisting is set to false.
     *
     * @see #pauseTriggerGroup(SchedulingContext, String)
     */
    public void storeTrigger(SchedulingContext ctxt, Trigger newTrigger,
            boolean replaceExisting) throws JobPersistenceException {
        TriggerWrapper tw = new TriggerWrapper((Trigger)newTrigger.clone());

        if (triggersByFQN.get(tw.key) != null) {
            if (!replaceExisting) {
                throw new ObjectAlreadyExistsException(newTrigger);
            }

            removeTrigger(ctxt, newTrigger.getName(), newTrigger.getGroup(), false);
        }

        if (retrieveJob(ctxt, newTrigger.getJobName(), newTrigger.getJobGroup()) == null) {
            throw new JobPersistenceException("The job ("
                    + newTrigger.getFullJobName()
                    + ") referenced by the trigger does not exist.");
        }

        synchronized (triggerLock) {
            // add to triggers array
            triggers.add(tw);
            // add to triggers by group
            HashMap grpMap = (HashMap) triggersByGroup.get(newTrigger
                    .getGroup());
            if (grpMap == null) {
                grpMap = new HashMap(100);
                triggersByGroup.put(newTrigger.getGroup(), grpMap);
            }
            grpMap.put(newTrigger.getName(), tw);
            // add to triggers by FQN map
            triggersByFQN.put(tw.key, tw);

            if (pausedTriggerGroups.contains(newTrigger.getGroup())
            		|| pausedJobGroups.contains(newTrigger.getJobGroup())) {
                tw.state = TriggerWrapper.STATE_PAUSED;
                if (blockedJobs.contains(tw.jobKey)) {
                    tw.state = TriggerWrapper.STATE_PAUSED_BLOCKED;
                }
            } else if (blockedJobs.contains(tw.jobKey)) {
                tw.state = TriggerWrapper.STATE_BLOCKED;
            } else {
                timeTriggers.add(tw);
            }
        }
    }

    /**
     * <p>
     * Remove (delete) the <code>{@link org.quartz.Trigger}</code> with the
     * given name.
     * </p>
     *
     * @param triggerName
     *          The name of the <code>Trigger</code> to be removed.
     * @param groupName
     *          The group name of the <code>Trigger</code> to be removed.
     * @return <code>true</code> if a <code>Trigger</code> with the given
     *         name & group was found and removed from the store.
     */
    public boolean removeTrigger(SchedulingContext ctxt, String triggerName,
            String groupName) {
        return removeTrigger(ctxt, triggerName, groupName, true);
    }
    private boolean removeTrigger(SchedulingContext ctxt, String triggerName,
            String groupName, boolean removeOrphanedJob) {
        String key = TriggerWrapper.getTriggerNameKey(triggerName, groupName);

        boolean found = false;

        synchronized (triggerLock) {
            // remove from triggers by FQN map
            found = (triggersByFQN.remove(key) == null) ? false : true;
            if (found) {
                TriggerWrapper tw = null;
                // remove from triggers by group
                HashMap grpMap = (HashMap) triggersByGroup.get(groupName);
                if (grpMap != null) {
                    grpMap.remove(triggerName);
                    if (grpMap.size() == 0) {
                        triggersByGroup.remove(groupName);
                    }
                }
                // remove from triggers array
                Iterator tgs = triggers.iterator();
                while (tgs.hasNext()) {
                    tw = (TriggerWrapper) tgs.next();
                    if (key.equals(tw.key)) {
                        tgs.remove();
                        break;
                    }
                }
                timeTriggers.remove(tw);

                if (removeOrphanedJob) {
                    JobWrapper jw = (JobWrapper) jobsByFQN.get(JobWrapper
                            .getJobNameKey(tw.trigger.getJobName(), tw.trigger
                                    .getJobGroup()));

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美一区二区在线视频| 国产传媒欧美日韩成人| 91免费版pro下载短视频| 国产精品婷婷午夜在线观看| 成人午夜激情片| 国产精品久久久99| 91免费版pro下载短视频| 亚洲日穴在线视频| 欧美吻胸吃奶大尺度电影 | 自拍偷拍亚洲激情| 欧美亚洲一区二区在线| 日韩不卡在线观看日韩不卡视频| 91精品一区二区三区在线观看| 裸体一区二区三区| 精品国产乱码久久久久久蜜臀| 国产精品亚洲专一区二区三区| 国产欧美日韩在线| 在线免费精品视频| 久久国产精品无码网站| 国产精品欧美一区喷水| 欧美亚洲综合在线| 久久av老司机精品网站导航| 国产欧美日韩不卡| 欧美午夜精品久久久久久孕妇 | 成人av电影在线| 亚洲va欧美va人人爽| 91麻豆精品国产91久久久 | 中文字幕av一区二区三区| 在线免费观看日韩欧美| 国内精品视频一区二区三区八戒| 中文字幕在线不卡视频| 国产性天天综合网| 99国产精品久| 亚洲电影第三页| 久久精子c满五个校花| 91福利视频在线| 久久精品夜夜夜夜久久| 久久精品国产亚洲一区二区三区| 欧美一区二区三区婷婷月色| 国产精品日韩精品欧美在线| 国产精品久久久久久妇女6080 | 日韩av一区二区在线影视| 韩国成人福利片在线播放| 91精品综合久久久久久| 午夜久久久久久久久久一区二区| 欧美性色综合网| 亚洲精品乱码久久久久久黑人 | 久久久久久夜精品精品免费| 蜜桃视频在线观看一区| 欧美视频第二页| 久久国产福利国产秒拍| 国产欧美精品日韩区二区麻豆天美| 亚洲日本青草视频在线怡红院| 亚洲成人免费视频| 欧美美女一区二区三区| 老司机精品视频线观看86| 欧美激情综合在线| 9191精品国产综合久久久久久| 污片在线观看一区二区| 国产女主播在线一区二区| 91国产免费看| 中文字幕一区二区三中文字幕| 色偷偷88欧美精品久久久| 日韩高清一级片| 亚洲欧洲精品一区二区三区不卡| 欧美网站一区二区| 国产**成人网毛片九色| 免费日韩伦理电影| 亚洲第一主播视频| 亚洲老妇xxxxxx| 99久久综合国产精品| 久久99精品国产麻豆不卡| 自拍偷拍国产精品| 中文字幕第一区二区| 欧美videossexotv100| 欧美日韩视频在线观看一区二区三区| 黄一区二区三区| 亚洲va国产天堂va久久en| 成人欧美一区二区三区小说| 国产网红主播福利一区二区| 国产成人亚洲综合色影视| 午夜精品久久久久久久| 亚洲免费观看视频| 欧美一三区三区四区免费在线看 | 欧美一级在线观看| 制服丝袜中文字幕亚洲| 99re热视频精品| 99re热这里只有精品视频| 亚洲最快最全在线视频| 欧美亚洲综合另类| 国产成人av电影在线| 性做久久久久久免费观看| 久久久不卡影院| 日韩你懂的电影在线观看| 在线中文字幕一区| 99视频一区二区三区| 国产一区二区三区不卡在线观看| 夜夜亚洲天天久久| 中文字幕一区二区三区色视频| 日韩三级中文字幕| 欧美日韩一区二区不卡| 91福利在线看| 欧美网站大全在线观看| 日本韩国欧美国产| 欧美无乱码久久久免费午夜一区 | 欧美精品一区二区三区四区| 欧美日韩久久不卡| 正在播放一区二区| 欧美午夜寂寞影院| 欧美电影免费观看高清完整版 | 成人av电影在线网| 亚洲日本中文字幕区| 欧美高清dvd| 这里只有精品电影| 久久久久久久综合狠狠综合| 午夜欧美视频在线观看| 欧美一区二区网站| 亚洲女人****多毛耸耸8| 3751色影院一区二区三区| 精品奇米国产一区二区三区| 欧美激情一区二区三区全黄| 亚洲国产另类av| 国产精品一区在线观看你懂的| 91免费看片在线观看| 精品国精品国产| 亚洲美女在线一区| 激情久久久久久久久久久久久久久久| www.欧美日韩| 夜夜精品视频一区二区| 亚洲18影院在线观看| 激情伊人五月天久久综合| 91影视在线播放| 精品国产a毛片| 一区二区三区日韩精品| 国产69精品久久久久毛片| 99久久久无码国产精品| 在线看日韩精品电影| 久久久久亚洲蜜桃| 青青草精品视频| 91黄色小视频| 亚洲色图制服诱惑| 国产精品小仙女| 色婷婷激情一区二区三区| 国产精品三级av在线播放| 免费观看30秒视频久久| 欧美性极品少妇| 国产精品私人影院| 激情综合网激情| 欧美福利一区二区| 午夜日韩在线电影| 欧美色视频一区| 午夜国产精品一区| 欧美日韩一区二区三区不卡| 亚洲三级小视频| 色婷婷av一区| 五月婷婷激情综合| 日韩你懂的电影在线观看| 成人黄色国产精品网站大全在线免费观看| 欧美精品日日鲁夜夜添| 日韩一级在线观看| 伦理电影国产精品| 国产欧美精品一区aⅴ影院| 成人精品高清在线| 风流少妇一区二区| 色88888久久久久久影院按摩| 色婷婷综合五月| 欧美视频一区二区三区四区| 亚洲日本电影在线| av一区二区三区| 亚洲色图.com| 欧美高清一级片在线| 亚洲成人av在线电影| 欧美性淫爽ww久久久久无| 亚洲码国产岛国毛片在线| 91美女福利视频| 亚洲免费观看高清完整版在线| av在线免费不卡| 欧美一区二区三区免费| 成人18视频在线播放| 天天操天天干天天综合网| 国产偷国产偷精品高清尤物| 91亚洲国产成人精品一区二三| 成人精品国产一区二区4080| 日韩一区在线看| 精品88久久久久88久久久| 欧美酷刑日本凌虐凌虐| 成人国产亚洲欧美成人综合网| 亚洲福利视频导航| 亚洲欧美另类小说| 国产精品一线二线三线精华| 日韩欧美一区二区视频| 国产日韩欧美一区二区三区综合| 亚洲色图第一区| 欧美日韩国产天堂| 奇米色777欧美一区二区| 久久综合九色综合97婷婷女人 | 97se亚洲国产综合自在线不卡| 综合中文字幕亚洲| 欧美日韩精品二区第二页| 老司机午夜精品|