⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ioexecutor.java

📁 基于Jabber协议的即时消息服务器
💻 JAVA
字号:
/** * $RCSfile$ * $Revision: $ * $Date: $ * * Copyright (C) 2006 Jive Software. All rights reserved. * * This software is published under the terms of the GNU Public License (GPL), * a copy of which is included in this distribution. */package org.jivesoftware.wildfire.net;import org.jivesoftware.util.JiveGlobals;import java.util.concurrent.LinkedBlockingQueue;import java.util.concurrent.ThreadPoolExecutor;import java.util.concurrent.TimeUnit;/** * Thread pool to be used for processing incoming packets when using non-blocking * connections. * * // TODO Change thead pool configuration. Would be nice to have something that can be * // TODO dynamically adjusted to demand and circumstances. * * @author Daniele Piras */class IOExecutor {    // SingleTon ...    protected static IOExecutor instance = new IOExecutor();    // Pool obj    protected ThreadPoolExecutor executeMsgPool;    // Internal queue for the pool    protected LinkedBlockingQueue<Runnable> executeQueue;    /*    * Simple constructor that initialize the main executor structure.    *    */    protected IOExecutor() {        // Read poolsize parameter...        int poolSize = JiveGlobals.getIntProperty("tiscali.pool.size", 15);        // Create queue for executor        executeQueue = new LinkedBlockingQueue<Runnable>();        // Create executor        executeMsgPool =                new ThreadPoolExecutor(poolSize, poolSize, 60, TimeUnit.SECONDS, executeQueue);    }    public static void execute(Runnable task) {        instance.executeMsgPool.execute(task);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -