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

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

?? threadpooltaskexecutor.java

?? struts+spring 源碼 希望能給大家?guī)韼椭?
?? JAVA
字號:
/*
 * Copyright 2002-2006 the original author or authors.
 *
 * 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.
 */

package org.springframework.scheduling.concurrent;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.scheduling.SchedulingTaskExecutor;
import org.springframework.util.Assert;

/**
 * JavaBean that allows for configuring a JDK 1.5 ThreadPoolExecutor in bean style
 * (through "corePoolSize", "maxPoolSize", "keepAliveSeconds", "queueCapacity" properties),
 * exposing it as both Spring TaskExecutor and JDK 1.5 Executor. This is an alternative
 * to configuring a ThreadPoolExecutor instance directly using constructor injection,
 * with a separate ConcurrentTaskExecutor adapter if necessary.
 *
 * <p>For any custom needs, in particular for defining a ScheduledThreadPoolExecutor,
 * it is recommended to use a straight definition of the JDK 1.5 Executor implementation
 * instance or a factory method definition that points to the JDK 1.5 Executors class.
 * To expose it as a Spring TaskExecutor, wrap it with a ConcurrentTaskExecutor adapter.
 *
 * @author Juergen Hoeller
 * @since 2.0
 * @see org.springframework.core.task.TaskExecutor
 * @see java.util.concurrent.Executor
 * @see java.util.concurrent.ThreadPoolExecutor
 * @see java.util.concurrent.ScheduledThreadPoolExecutor
 * @see java.util.concurrent.Executors
 * @see ConcurrentTaskExecutor
 */
public class ThreadPoolTaskExecutor implements SchedulingTaskExecutor, Executor, InitializingBean, DisposableBean {

	protected final Log logger = LogFactory.getLog(getClass());

	private int corePoolSize = 1;

	private int maxPoolSize = Integer.MAX_VALUE;

	private int keepAliveSeconds = 60;

	private int queueCapacity = Integer.MAX_VALUE;

	private ThreadFactory threadFactory = Executors.defaultThreadFactory();

	private RejectedExecutionHandler rejectedExecutionHandler = new ThreadPoolExecutor.AbortPolicy();

	private ThreadPoolExecutor executorService;


	/**
	 * Set the ThreadPoolExecutor's core pool size.
	 * Default is 1.
	 */
	public void setCorePoolSize(int corePoolSize) {
		this.corePoolSize = corePoolSize;
	}

	/**
	 * Set the ThreadPoolExecutor's maximum pool size.
	 * Default is <code>Integer.MAX_VALUE</code>.
	 */
	public void setMaxPoolSize(int maxPoolSize) {
		this.maxPoolSize = maxPoolSize;
	}

	/**
	 * Set the ThreadPoolExecutor's keep alive seconds.
	 * Default is 60.
	 */
	public void setKeepAliveSeconds(int keepAliveSeconds) {
		this.keepAliveSeconds = keepAliveSeconds;
	}

	/**
	 * Set the capacity for the ThreadPoolExecutor's BlockingQueue.
	 * Default is <code>Integer.MAX_VALUE</code>.
	 * <p>Any positive value will lead to a LinkedBlockingQueue instance;
	 * any other value will lead to a SynchronousQueue instance.
	 * @see java.util.concurrent.LinkedBlockingQueue
	 * @see java.util.concurrent.SynchronousQueue
	 */
	public void setQueueCapacity(int queueCapacity) {
		this.queueCapacity = queueCapacity;
	}

	/**
	 * Set the ThreadFactory to use for the ThreadPoolExecutor's thread pool.
	 * Default is the ThreadPoolExecutor's default thread factory.
	 * @see java.util.concurrent.Executors#defaultThreadFactory()
	 */
	public void setThreadFactory(ThreadFactory threadFactory) {
		this.threadFactory = (threadFactory != null ? threadFactory : Executors.defaultThreadFactory());
	}

	/**
	 * Set the RejectedExecutionHandler to use for the ThreadPoolExecutor.
	 * Default is the ThreadPoolExecutor's default abort policy.
	 * @see java.util.concurrent.ThreadPoolExecutor.AbortPolicy
	 */
	public void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) {
		this.rejectedExecutionHandler =
				(rejectedExecutionHandler != null ? rejectedExecutionHandler : new ThreadPoolExecutor.AbortPolicy());
	}


	/**
	 * Calls <code>initialize()</code> after the container applied all property values.
	 * @see #initialize()
	 */
	public void afterPropertiesSet() {
		initialize();
	}

	/**
	 * Creates the BlockingQueue and the ThreadPoolExecutor.
	 * @see #createQueue
	 */
	public void initialize() {
		logger.info("Creating ThreadPoolExecutor");
		BlockingQueue queue = createQueue(this.queueCapacity);
		this.executorService = new ThreadPoolExecutor(
				this.corePoolSize, this.maxPoolSize, this.keepAliveSeconds, TimeUnit.SECONDS,
				queue, this.threadFactory, this.rejectedExecutionHandler);
	}

	/**
	 * Create the BlockingQueue to use for the ThreadPoolExecutor.
	 * <p>A LinkedBlockingQueue instance will be created for a positive
	 * capacity value; a SynchronousQueue else.
	 * @param queueCapacity the specified queue capacity
	 * @return the BlockingQueue instance
	 * @see java.util.concurrent.LinkedBlockingQueue
	 * @see java.util.concurrent.SynchronousQueue
	 */
	protected BlockingQueue createQueue(int queueCapacity) {
		if (this.queueCapacity > 0) {
			return new LinkedBlockingQueue(this.queueCapacity);
		}
		else {
			return new SynchronousQueue();
		}
	}


	/**
	 * Implementation of both the JDK 1.5 Executor interface
	 * and the Spring TaskExecutor interface, delegating to
	 * the ThreadPoolExecutor instance.
	 * @see java.util.concurrent.Executor#execute(Runnable)
	 * @see org.springframework.core.task.TaskExecutor#execute(Runnable)
	 */
	public void execute(Runnable task) {
		Assert.notNull(this.executorService, "ThreadPoolTaskExecutor not initialized");
		this.executorService.execute(task);
	}

	/**
	 * This task executor prefers short-lived work units.
	 */
	public boolean prefersShortLivedTasks() {
		return true;
	}


	/**
	 * Calls <code>shutdown</code> when the BeanFactory destroys
	 * the task executor instance.
	 * @see #shutdown()
	 */
	public void destroy() {
		shutdown();
	}

	/**
	 * Perform a shutdown on the ThreadPoolExecutor.
	 * @see java.util.concurrent.ThreadPoolExecutor#shutdown()
	 */
	public void shutdown() {
		logger.info("Shutting down ThreadPoolExecutor");
		this.executorService.shutdown();
	}

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品福利视频一区二区三区| 亚洲日本va在线观看| 国产色产综合色产在线视频| 亚洲美女精品一区| 国产乱人伦偷精品视频免下载| 在线观看欧美精品| 国产精品看片你懂得| 精品一区二区三区在线观看 | 国产一区二区视频在线播放| 在线亚洲免费视频| 国产精品你懂的| 国产乱国产乱300精品| 欧美一区二区三区不卡| 亚洲一区二区偷拍精品| 97se亚洲国产综合自在线不卡| 日韩欧美中文字幕公布| 亚洲一区二区三区影院| av中文字幕不卡| 国产精品你懂的| 国产成人av电影在线| 26uuu欧美| 国产自产高清不卡| 精品少妇一区二区三区免费观看| 丝袜诱惑亚洲看片| 欧美人体做爰大胆视频| 婷婷综合另类小说色区| 秋霞午夜av一区二区三区| 樱花影视一区二区| 欧美性淫爽ww久久久久无| 美女久久久精品| 亚洲一区二区在线观看视频| 亚洲免费在线播放| 久久久久久影视| 欧美xxxxx裸体时装秀| 欧美色图在线观看| 91小视频免费看| 91女人视频在线观看| 91成人在线精品| av成人老司机| 99国产精品久久久久久久久久| 国产精品1024久久| 国产一区啦啦啦在线观看| 国产美女主播视频一区| 视频一区二区国产| 91亚洲资源网| 亚洲精品国产精华液| 色综合久久久久久久久久久| 久久久久99精品一区| 成人欧美一区二区三区在线播放| 久久久噜噜噜久久人人看| 色94色欧美sute亚洲线路一ni| 国产激情偷乱视频一区二区三区| 久久草av在线| 91超碰这里只有精品国产| 麻豆精品视频在线| 国产成人午夜片在线观看高清观看| 国产成人丝袜美腿| 日韩激情av在线| 日韩亚洲电影在线| 成人一道本在线| 亚洲一区二区在线免费看| 精品精品国产高清一毛片一天堂| 成人av网站免费| 香蕉成人伊视频在线观看| 久久女同性恋中文字幕| 色爱区综合激月婷婷| 精品午夜久久福利影院| 亚洲美女免费视频| 亚洲精品一区二区三区影院| 99久久er热在这里只有精品66| 天堂成人国产精品一区| 国产精品乱码人人做人人爱| 欧美电影在线免费观看| 波多野结衣在线aⅴ中文字幕不卡| 亚洲成人激情综合网| 欧美激情一区在线观看| 6080yy午夜一二三区久久| 北岛玲一区二区三区四区| 日本三级亚洲精品| 亚洲另类在线一区| 国产日韩精品久久久| 91精品久久久久久久91蜜桃| 成人的网站免费观看| 久久er99热精品一区二区| 亚洲精品国产精品乱码不99| 国产午夜一区二区三区| 日韩一区二区在线观看视频播放| 一本色道久久综合狠狠躁的推荐| 国产一区在线不卡| 蜜桃91丨九色丨蝌蚪91桃色| 一区二区欧美精品| 国产精品久久久久一区二区三区| 欧美成人精品福利| 制服丝袜亚洲播放| 欧美视频一区在线| 91浏览器打开| www.在线成人| 国产乱码精品一区二区三区av| 免费高清不卡av| 人妖欧美一区二区| 日本美女一区二区三区视频| 一区二区三区四区不卡在线| 国产精品久久久久久久久免费相片 | 精品国产凹凸成av人导航| 欧美日韩一区二区三区在线看| eeuss国产一区二区三区| 成人免费视频一区二区| 国产成a人亚洲精品| 国产精品亚洲第一| 国产成人精品三级| 成人一级片在线观看| 国产福利一区二区三区视频| 国产精品自拍毛片| 欧美日本一区二区在线观看| 麻豆精品精品国产自在97香蕉| 国产精品伦一区| 337p亚洲精品色噜噜| jlzzjlzz亚洲日本少妇| 久久电影网站中文字幕| 中文字幕视频一区| 国产午夜亚洲精品不卡| 欧美另类变人与禽xxxxx| 99久久精品免费| 国产乱对白刺激视频不卡 | caoporen国产精品视频| 日本aⅴ免费视频一区二区三区| 国产精品免费视频观看| 久久久一区二区三区| 日韩一卡二卡三卡国产欧美| 欧美日韩免费观看一区三区| 91福利在线导航| 北条麻妃一区二区三区| 91精品国产一区二区三区香蕉 | 久久精品99国产精品日本| 国内成人免费视频| 91精品国产91综合久久蜜臀| 不卡欧美aaaaa| 日本伊人色综合网| 日本亚洲三级在线| 精品一区二区三区在线播放视频| 日韩av一区二区在线影视| 在线亚洲一区二区| 日韩av高清在线观看| 91麻豆视频网站| 美女一区二区三区在线观看| 韩国精品免费视频| 色综合色狠狠综合色| 91精品国产手机| 欧美极品aⅴ影院| 香港成人在线视频| 国产91精品在线观看| 欧美伊人久久久久久久久影院| 欧美mv和日韩mv的网站| 专区另类欧美日韩| 久久精品噜噜噜成人av农村| 91尤物视频在线观看| 欧美一区二区福利在线| 国产精品日产欧美久久久久| 婷婷夜色潮精品综合在线| 成人精品视频一区| 91精品国产综合久久久久久漫画 | 久久影音资源网| 亚洲综合一区二区| 国产69精品一区二区亚洲孕妇| 欧美色大人视频| 国产精品伦一区| 国产精品白丝av| 欧美精品成人一区二区三区四区| 国产精品国产三级国产普通话蜜臀 | 国内精品久久久久影院色| 色噜噜狠狠色综合中国| 欧美国产禁国产网站cc| 久久成人精品无人区| 欧美日韩一级黄| 国产精品高潮呻吟| 国产成人午夜99999| 精品久久久久久最新网址| 亚洲aaa精品| 欧洲精品中文字幕| 日韩一区欧美小说| 成人综合激情网| 国产丝袜美腿一区二区三区| 日本网站在线观看一区二区三区| 在线免费av一区| 亚洲精品国产无套在线观| 99久久伊人精品| 国产精品国产三级国产有无不卡 | 久久伊人蜜桃av一区二区| 轻轻草成人在线| 欧美理论电影在线| 亚洲国产中文字幕| 欧洲亚洲国产日韩| 一区二区三区视频在线看| 色婷婷一区二区| 亚洲资源中文字幕| 欧美午夜精品电影| 亚洲国产裸拍裸体视频在线观看乱了| 色综合亚洲欧洲| 亚洲一区免费观看| 欧美日韩精品一区二区三区蜜桃 |