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

📄 threadpool.java

📁 一个实用工具类
💻 JAVA
字号:
/* * Copyright (C) butor.com. All rights reserved. * * This software is published under the terms of the GNU Library General * Public License (GNU LGPL), a copy of which has been included with this * distribution in the LICENSE.txt file.  */package org.butor.resourcePool.threadPoolService;import org.butor.fwService.FwService;import org.butor.fwService.IFwServiceImpl;/** * ---------------------------------------------------------------- * 2000jun21,deb: Initial version 2001jan29,deb: - getNextRunnable() */public class ThreadPool {	protected static FwService fwService = new FwService(ThreadPool.class);	public static boolean isImplCompatible(IFwServiceImpl impl) {		return (impl instanceof IThreadPool);	}	public static String getServiceName() {		return ThreadPool.class.getName();	}	public static void registerImpl(IFwServiceImpl impl) {		fwService.registerImpl(impl);	}	public static void unregisterImpl(IFwServiceImpl impl) {		fwService.unregisterImpl(impl);	}	protected static IThreadPool getImpl(String calledMethod) {		return (IThreadPool) fwService.getImpl(calledMethod);	}	/**	 * This method is called by the clients that want to process a task. The	 * task is put in the f_waitingTasksQ and if a thread is available in the	 * f_waitQ or the pool has not reached the maximum number of threads, the	 * task is assigned to a thread.	 * 	 * @param task	 *            java.lang.Runnable The new task to process	 */	public static void run(Runnable task) {		IThreadPool impl = getImpl("run()");		if (null != impl) {			impl.run(task);		}	}}

⌨️ 快捷键说明

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