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

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

?? simplethreadpool.java

?? Java中非常實(shí)用流控制工具
?? JAVA
?? 第 1 頁 / 共 2 頁
字號(hào):
/* 
 * 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 org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.SchedulerConfigException;
import org.quartz.spi.ThreadPool;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

/**
 * <p>
 * This is class is a simple implementation of a thread pool, based on the
 * <code>{@link org.quartz.spi.ThreadPool}</code> interface.
 * </p>
 * 
 * <p>
 * <CODE>Runnable</CODE> objects are sent to the pool with the <code>{@link #runInThread(Runnable)}</code>
 * method, which blocks until a <code>Thread</code> becomes available.
 * </p>
 * 
 * <p>
 * The pool has a fixed number of <code>Thread</code>s, and does not grow or
 * shrink based on demand.
 * </p>
 * 
 * @author James House
 * @author Juergen Donnerstag
 */
public class SimpleThreadPool implements ThreadPool {

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

    private int count = -1;

    private int prio = Thread.NORM_PRIORITY;

    private boolean isShutdown = false;
    private boolean handoffPending = false;

    private boolean inheritLoader = false;

    private boolean inheritGroup = true;

    private boolean makeThreadsDaemons = false;

    private ThreadGroup threadGroup;

    private final Object nextRunnableLock = new Object();

    private List workers;
    private LinkedList availWorkers = new LinkedList();
    private LinkedList busyWorkers = new LinkedList();

    private String threadNamePrefix = "SimpleThreadPoolWorker";

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

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

    /**
     * <p>
     * Create a new (unconfigured) <code>SimpleThreadPool</code>.
     * </p>
     * 
     * @see #setThreadCount(int)
     * @see #setThreadPriority(int)
     */
    public SimpleThreadPool() {
    }

    /**
     * <p>
     * Create a new <code>SimpleThreadPool</code> with the specified number
     * of <code>Thread</code> s that have the given priority.
     * </p>
     * 
     * @param threadCount
     *          the number of worker <code>Threads</code> in the pool, must
     *          be > 0.
     * @param threadPriority
     *          the thread priority for the worker threads.
     * 
     * @see java.lang.Thread
     */
    public SimpleThreadPool(int threadCount, int threadPriority) {
        setThreadCount(threadCount);
        setThreadPriority(threadPriority);
    }

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

    public Log getLog() {
        return log;
    }

    public int getPoolSize() {
        return getThreadCount();
    }

    /**
     * <p>
     * Set the number of worker threads in the pool - has no effect after
     * <code>initialize()</code> has been called.
     * </p>
     */
    public void setThreadCount(int count) {
        this.count = count;
    }

    /**
     * <p>
     * Get the number of worker threads in the pool.
     * </p>
     */
    public int getThreadCount() {
        return count;
    }

    /**
     * <p>
     * Set the thread priority of worker threads in the pool - has no effect
     * after <code>initialize()</code> has been called.
     * </p>
     */
    public void setThreadPriority(int prio) {
        this.prio = prio;
    }

    /**
     * <p>
     * Get the thread priority of worker threads in the pool.
     * </p>
     */
    public int getThreadPriority() {
        return prio;
    }

    public void setThreadNamePrefix(String prfx) {
        this.threadNamePrefix = prfx;
    }

    public String getThreadNamePrefix() {
        return threadNamePrefix;
    }

    /**
     * @return Returns the
     *         threadsInheritContextClassLoaderOfInitializingThread.
     */
    public boolean isThreadsInheritContextClassLoaderOfInitializingThread() {
        return inheritLoader;
    }

    /**
     * @param inheritLoader
     *          The threadsInheritContextClassLoaderOfInitializingThread to
     *          set.
     */
    public void setThreadsInheritContextClassLoaderOfInitializingThread(
            boolean inheritLoader) {
        this.inheritLoader = inheritLoader;
    }

    public boolean isThreadsInheritGroupOfInitializingThread() {
        return inheritGroup;
    }

    public void setThreadsInheritGroupOfInitializingThread(
            boolean inheritGroup) {
        this.inheritGroup = inheritGroup;
    }


    /**
     * @return Returns the value of makeThreadsDaemons.
     */
    public boolean isMakeThreadsDaemons() {
        return makeThreadsDaemons;
    }

    /**
     * @param makeThreadsDaemons
     *          The value of makeThreadsDaemons to set.
     */
    public void setMakeThreadsDaemons(boolean makeThreadsDaemons) {
        this.makeThreadsDaemons = makeThreadsDaemons;
    }

    public void initialize() throws SchedulerConfigException {

        if (count <= 0) {
            throw new SchedulerConfigException(
                    "Thread count must be > 0");
        }
        if (prio <= 0 || prio > 9) {
            throw new SchedulerConfigException(
                    "Thread priority must be > 0 and <= 9");
        }

        if(isThreadsInheritGroupOfInitializingThread()) {
            threadGroup = Thread.currentThread().getThreadGroup();
        } else {
            // follow the threadGroup tree to the root thread group.
            threadGroup = Thread.currentThread().getThreadGroup();
            ThreadGroup parent = threadGroup;
            while ( !parent.getName().equals("main") ) {
                threadGroup = parent;
                parent = threadGroup.getParent();
            }
            threadGroup = new ThreadGroup(parent, "SimpleThreadPool");
            if (isMakeThreadsDaemons()) {
                threadGroup.setDaemon(true);
            }
        }


        if (isThreadsInheritContextClassLoaderOfInitializingThread()) {
            getLog().info(
                    "Job execution threads will use class loader of thread: "
                            + Thread.currentThread().getName());
        }

        // create the worker threads and start them
        Iterator workerThreads = createWorkerThreads(count).iterator();
        while(workerThreads.hasNext()) {
            WorkerThread wt = (WorkerThread) workerThreads.next();
            wt.start();
            availWorkers.add(wt);
        }
    }

    protected List createWorkerThreads(int count) {
        workers = new LinkedList();
        for (int i = 1; i<= count; ++i) {
            WorkerThread wt = new WorkerThread(this, threadGroup,
                getThreadNamePrefix() + "-" + i,
                getThreadPriority(),
                isMakeThreadsDaemons());
            if (isThreadsInheritContextClassLoaderOfInitializingThread()) {
                wt.setContextClassLoader(Thread.currentThread()
                        .getContextClassLoader());
            }
            workers.add(wt);
        }

        return workers;
    }

    /**

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产欧美一区二区在线| 亚洲欧美影音先锋| 成人黄色免费短视频| 亚洲va国产va欧美va观看| 久久久久久久久久电影| 欧美日韩不卡一区二区| 不卡视频一二三四| 韩国精品久久久| 午夜精品久久久久久久99樱桃| 国产日产精品1区| 91精品一区二区三区在线观看| 91视频.com| 成人性生交大片| 激情文学综合插| 日韩制服丝袜av| 亚洲综合在线视频| 成人欧美一区二区三区小说 | 久久久久国产免费免费| 欧美精品在线一区二区三区| 91婷婷韩国欧美一区二区| 国产成人一区二区精品非洲| 久久99国产精品久久99果冻传媒| 玉足女爽爽91| 日韩伦理av电影| 国产精品卡一卡二卡三| 国产日韩欧美高清| 久久精品日韩一区二区三区| 精品久久久久一区| 欧美大片一区二区| 日韩欧美中文字幕公布| 4438x亚洲最大成人网| 在线中文字幕不卡| 欧美影院一区二区三区| 欧美午夜精品一区| 欧美性色黄大片| 欧美在线看片a免费观看| 91女厕偷拍女厕偷拍高清| av不卡在线播放| 91香蕉视频污| 色狠狠色狠狠综合| 欧美日韩视频第一区| 欧美军同video69gay| 91精品一区二区三区在线观看| 欧美精品一卡二卡| 精品少妇一区二区三区免费观看| 欧美一级二级在线观看| 欧美一区二区三区影视| 欧美成人性福生活免费看| 精品国产一区二区三区久久影院 | 成人国产精品免费| 成人激情免费视频| 色婷婷激情久久| 欧美日韩亚州综合| 欧美一级二级三级蜜桃| 欧美精品一区二区不卡| 国产精品午夜久久| 亚洲精品视频在线观看网站| 亚洲国产日韩a在线播放| 午夜精品久久久久久久| 精品一区二区在线视频| 成人看片黄a免费看在线| 91色视频在线| 91精品在线一区二区| 精品乱人伦小说| 中文字幕亚洲在| 性感美女极品91精品| 精品夜夜嗨av一区二区三区| 国产91精品一区二区| 色哟哟日韩精品| 91精品久久久久久蜜臀| 国产色一区二区| 亚洲精品高清在线观看| 蓝色福利精品导航| 91亚洲精品久久久蜜桃| 这里只有精品电影| 亚洲国产精品激情在线观看| 亚洲成av人片在线观看| 国产精品一区免费视频| 91久久人澡人人添人人爽欧美| 制服丝袜亚洲网站| 国产精品毛片久久久久久久| 亚洲va在线va天堂| 国产成人综合精品三级| 欧美系列日韩一区| 国产欧美日产一区| 午夜精品成人在线视频| 成人激情校园春色| 欧美成va人片在线观看| 亚洲欧美日韩中文播放| 久久国产精品99久久久久久老狼| 色婷婷av一区二区三区大白胸| 久久婷婷国产综合国色天香 | 国产aⅴ综合色| 欧美高清hd18日本| 国产精品久久久久久户外露出 | 亚洲综合自拍偷拍| 国产成人一级电影| 日韩欧美中文字幕一区| 亚洲精品成a人| 国产成人免费高清| 91麻豆精品91久久久久久清纯| 综合欧美亚洲日本| 国产一区二区三区最好精华液| 欧美精品国产精品| 洋洋av久久久久久久一区| 成人动漫视频在线| 久久久蜜桃精品| 免费成人你懂的| 欧美日韩国产片| 亚洲欧美一区二区三区国产精品| 国产精品1区2区3区在线观看| 欧美电影在线免费观看| 一区二区三区四区中文字幕| 成人av网站在线| 精品国产免费人成在线观看| 亚洲成人第一页| 欧美亚洲另类激情小说| 国产精品久久久久久亚洲毛片 | 欧美另类一区二区三区| 亚洲少妇30p| 成人久久久精品乱码一区二区三区| 欧美成人aa大片| 蜜桃传媒麻豆第一区在线观看| 欧美日韩精品免费| 亚洲一区二区在线观看视频| 99国产精品视频免费观看| 欧美激情中文字幕| 国产成人精品亚洲午夜麻豆| 26uuu欧美| 狠狠色综合日日| 久久综合国产精品| 国产精品一区二区果冻传媒| 337p日本欧洲亚洲大胆精品| 国产老肥熟一区二区三区| 久久伊人中文字幕| 国产成人午夜视频| 国产欧美精品一区二区色综合 | 久久成人综合网| 精品国产一区二区在线观看| 美女mm1313爽爽久久久蜜臀| 9191久久久久久久久久久| 亚洲成a人片在线观看中文| 欧美精品高清视频| 美女视频网站久久| 26uuu国产在线精品一区二区| 国产乱人伦精品一区二区在线观看| 久久综合久色欧美综合狠狠| 国产精品原创巨作av| 欧美激情一区二区三区四区 | 大白屁股一区二区视频| 国产精品乱码妇女bbbb| 99精品视频中文字幕| 一区二区日韩电影| 在线播放/欧美激情| 韩国一区二区三区| 中文字幕免费不卡在线| 91麻豆成人久久精品二区三区| 亚洲人成7777| 欧美精品九九99久久| 狠狠狠色丁香婷婷综合激情 | 成人晚上爱看视频| 一区二区三区免费网站| 欧美日韩mp4| 韩国av一区二区| 成人欧美一区二区三区小说| 欧美日韩一区二区三区在线看 | 国产麻豆一精品一av一免费 | 日韩一区二区在线观看| 国产大片一区二区| 亚洲一二三四在线| 日韩欧美国产成人一区二区| 成人app网站| 日韩精品电影在线观看| 日本一区二区三区在线观看| 欧洲一区二区三区免费视频| 久久国产麻豆精品| 中文字幕佐山爱一区二区免费| 欧美精品黑人性xxxx| 成人精品国产一区二区4080| 午夜精品福利一区二区三区蜜桃| 久久久久久久久99精品| 欧美日韩精品欧美日韩精品一| 国产成人亚洲精品青草天美| 亚洲成a人片在线不卡一二三区 | 久久男人中文字幕资源站| 一本大道久久a久久综合| 久久电影国产免费久久电影| 亚洲欧美另类小说| 欧美精品一区二区三区蜜桃 | 欧美国产精品v| 777xxx欧美| 91丝袜美腿高跟国产极品老师 | 欧美最新大片在线看| 国产九九视频一区二区三区| 亚洲国产日韩a在线播放性色| 国产色一区二区| 日韩女优电影在线观看| 欧洲一区二区av| aaa欧美色吧激情视频| 国产乱淫av一区二区三区 |