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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? threadpool.java

?? 一個類似超級瑪麗的Java游戲 來自《Developing Games in Java》的一個游戲編程實例
?? JAVA
字號:
package com.brackeen.javagamebook.util;
import java.util.LinkedList;

/**
    A thread pool is a group of a limited number of threads that
    are used to execute tasks.
	Download by http://www.codefans.net
*/
public class ThreadPool extends ThreadGroup {

    private boolean isAlive;
    private LinkedList taskQueue;
    private int threadID;
    private static int threadPoolID;

    /**
        Creates a new ThreadPool.
        @param numThreads The number of threads in the pool.
    */
    public ThreadPool(int numThreads) {
        super("ThreadPool-" + (threadPoolID++));
        setDaemon(true);

        isAlive = true;

        taskQueue = new LinkedList();
        for (int i=0; i<numThreads; i++) {
            new PooledThread().start();
        }
    }


    /**
        Requests a new task to run. This method returns
        immediately, and the task executes on the next available
        idle thread in this ThreadPool.
        <p>Tasks start execution in the order they are received.
        @param task The task to run. If null, no action is taken.
        @throws IllegalStateException if this ThreadPool is
        already closed.
    */
    public synchronized void runTask(Runnable task) {
        if (!isAlive) {
            throw new IllegalStateException();
        }
        if (task != null) {
            taskQueue.add(task);
            notify();
        }

    }


    protected synchronized Runnable getTask()
        throws InterruptedException
    {
        while (taskQueue.size() == 0) {
            if (!isAlive) {
                return null;
            }
            wait();
        }
        return (Runnable)taskQueue.removeFirst();
    }


    /**
        Closes this ThreadPool and returns immediately. All
        threads are stopped, and any waiting tasks are not
        executed. Once a ThreadPool is closed, no more tasks can
        be run on this ThreadPool.
    */
    public synchronized void close() {
        if (isAlive) {
            isAlive = false;
            taskQueue.clear();
            interrupt();
        }
    }


    /**
        Closes this ThreadPool and waits for all running threads
        to finish. Any waiting tasks are executed.
    */
    public void join() {
        // notify all waiting threads that this ThreadPool is no
        // longer alive
        synchronized (this) {
            isAlive = false;
            notifyAll();
        }

        // wait for all threads to finish
        Thread[] threads = new Thread[activeCount()];
        int count = enumerate(threads);
        for (int i=0; i<count; i++) {
            try {
                threads[i].join();
            }
            catch (InterruptedException ex) { }
        }
    }



    /**
        Signals that a PooledThread has started. This method
        does nothing by default; subclasses should override to do
        any thread-specific startup tasks.
    */
    protected void threadStarted() {
        // do nothing
    }


    /**
        Signals that a PooledThread has stopped. This method
        does nothing by default; subclasses should override to do
        any thread-specific cleanup tasks.
    */
    protected void threadStopped() {
        // do nothing
    }


    /**
        A PooledThread is a Thread in a ThreadPool group, designed
        to run tasks (Runnables).
    */
    private class PooledThread extends Thread {


        public PooledThread() {
            super(ThreadPool.this,
                "PooledThread-" + (threadID++));
        }


        public void run() {
            // signal that this thread has started
            threadStarted();

            while (!isInterrupted()) {

                // get a task to run
                Runnable task = null;
                try {
                    task = getTask();
                }
                catch (InterruptedException ex) { }

                // if getTask() returned null or was interrupted,
                // close this thread.
                if (task == null) {
                    break;
                }

                // run the task, and eat any exceptions it throws
                try {
                    task.run();
                }
                catch (Throwable t) {
                    uncaughtException(this, t);
                }
            }
            // signal that this thread has stopped
            threadStopped();
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产老妇另类xxxxx| 青娱乐精品在线视频| 久久影院电视剧免费观看| 欧美日韩1区2区| 欧美日韩一区国产| 欧美伦理影视网| 欧美一区二区精品久久911| 欧美欧美欧美欧美首页| 91麻豆精品国产91久久久更新时间| 欧美综合久久久| 欧美久久婷婷综合色| 日韩欧美亚洲一区二区| 久久综合九色欧美综合狠狠| 国产免费观看久久| 亚洲人成小说网站色在线| 一级特黄大欧美久久久| 亚洲成年人影院| 精品一区二区免费| 丁香婷婷综合五月| 91美女片黄在线观看| 欧美三区在线视频| 精品欧美黑人一区二区三区| 国产精品区一区二区三| 亚洲国产一二三| 韩国成人精品a∨在线观看| 丁香婷婷综合网| 欧美理论电影在线| 久久精品亚洲精品国产欧美kt∨| 中文字幕在线播放不卡一区| 亚洲成人免费在线观看| 国产一区二区三区av电影| 99国产精品国产精品久久| 欧美高清视频不卡网| 久久精品欧美日韩精品| 亚洲一区二区中文在线| 精品一区二区三区视频| 色综合天天综合网国产成人综合天| 777午夜精品免费视频| 国产精品午夜电影| 日韩精品福利网| 91小宝寻花一区二区三区| 欧美成人午夜电影| 一区二区三区四区激情| 国产成人在线影院| 这里只有精品视频在线观看| 中文字幕在线不卡一区| 激情亚洲综合在线| 欧美久久久久久蜜桃| 亚洲欧美中日韩| 国内一区二区在线| 欧美一区三区四区| 亚洲一区二区3| 播五月开心婷婷综合| 精品国产乱码久久久久久闺蜜| 亚洲国产精品麻豆| 91在线观看视频| 久久久久99精品国产片| 美国毛片一区二区| 欧美群妇大交群的观看方式| 亚洲欧美视频在线观看| 国产91精品一区二区| 精品久久久久久久久久久久久久久久久| 亚洲视频在线一区观看| 成人免费观看男女羞羞视频| 精品国产一区久久| 久久99热99| 日韩欧美中文字幕一区| 日本亚洲三级在线| 91精选在线观看| 视频一区二区不卡| 欧美久久一二三四区| 视频一区在线播放| 欧美一区二区美女| 蜜桃传媒麻豆第一区在线观看| 欧美另类一区二区三区| 日韩黄色在线观看| 欧美一区二区三区视频| 奇米精品一区二区三区在线观看 | 欧美美女一区二区| 亚洲伊人色欲综合网| 欧美调教femdomvk| 午夜免费久久看| 911国产精品| 精品一区二区三区在线视频| 精品国产一二三区| 丁香婷婷综合色啪| 日韩美女精品在线| 在线观看亚洲一区| 日韩中文字幕av电影| 日韩一卡二卡三卡| 国产精品一区二区三区乱码 | 成人av在线资源网站| 1区2区3区精品视频| 色老汉av一区二区三区| 日韩中文字幕区一区有砖一区| 日韩欧美精品在线视频| 国产成人av电影在线播放| 亚洲欧美日韩系列| 91精品视频网| 成人美女在线观看| 一二三区精品视频| 欧美成人r级一区二区三区| 国产乱码字幕精品高清av| 国产精品理伦片| 欧美三级三级三级| 国产精品白丝jk黑袜喷水| 中文字幕永久在线不卡| 这里只有精品99re| a级高清视频欧美日韩| 丝袜亚洲另类丝袜在线| 久久人人97超碰com| 一本一道综合狠狠老| 久久www免费人成看片高清| 中文字幕视频一区| 欧美一区二区三级| 91一区在线观看| 麻豆极品一区二区三区| 国产精品家庭影院| 日韩欧美国产精品一区| 一本大道av一区二区在线播放| 久久99久国产精品黄毛片色诱| 国产精品美女久久久久aⅴ| 这里只有精品免费| 色综合久久六月婷婷中文字幕| 精品一区二区三区免费视频| 一区二区激情视频| 国产精品久久久久久亚洲毛片| 在线电影一区二区三区| 波多野结衣在线一区| 极品瑜伽女神91| 肉肉av福利一精品导航| 亚洲私人影院在线观看| 欧美国产日本韩| 日韩欧美成人激情| 欧美精品粉嫩高潮一区二区| 99在线精品观看| 粉嫩av一区二区三区在线播放| 老司机精品视频在线| 日韩精品一卡二卡三卡四卡无卡| 亚洲另类色综合网站| 亚洲欧洲美洲综合色网| 久久精品亚洲精品国产欧美 | 不卡区在线中文字幕| 狠狠久久亚洲欧美| 理论片日本一区| 另类成人小视频在线| 免费精品视频最新在线| 日韩国产欧美在线观看| 午夜精品免费在线观看| 亚洲第一综合色| 亚洲主播在线观看| 亚洲高清在线精品| 亚洲成人tv网| 视频一区二区三区中文字幕| 丝袜亚洲另类欧美| 蜜臀av一区二区三区| 久久精品免费看| 精品亚洲免费视频| 国产在线视频一区二区| 国产老肥熟一区二区三区| 国产丶欧美丶日本不卡视频| 国产精品一级黄| 成人av在线资源网| 欧美亚洲国产bt| 7777精品伊人久久久大香线蕉经典版下载 | 91在线视频免费观看| 91蜜桃传媒精品久久久一区二区| 色婷婷综合久久| 欧美日韩夫妻久久| 精品国产乱子伦一区| 国产人成一区二区三区影院| 国产精品―色哟哟| 一区二区三区免费网站| 天堂蜜桃91精品| 国产一区欧美二区| jlzzjlzz国产精品久久| 欧美日韩一区三区四区| 日韩视频免费观看高清完整版 | 中文字幕亚洲在| 香蕉影视欧美成人| 国产福利精品导航| 色狠狠一区二区| 日韩欧美高清dvd碟片| 国产精品九色蝌蚪自拍| 无码av中文一区二区三区桃花岛| 极品销魂美女一区二区三区| 97久久精品人人做人人爽50路 | 久久久国产午夜精品| 日韩美女视频一区| 蜜桃视频在线观看一区| 91丨九色丨尤物| 欧美videossexotv100| 自拍偷拍欧美精品| 麻豆成人在线观看| 色综合婷婷久久| 国产喷白浆一区二区三区| 日韩二区三区在线观看| 成人av免费网站| 精品国产电影一区二区| 亚洲主播在线播放|