Java并發開發包 util.concurrent
util.concurrent 是一個 Java 語言的并發開發包,這個類庫由以下接口實現組:
Sync-- locks, conditionsChannel-- queues, buffersBarrier-- multi-party synchronizationSynchronizedVariable-- atomic ints, refs etcjava.util.Collection-- collectionsExecutor-- replacements for direct use of Thread
public class Executor
{
private static Logger logger = Logger.getLogger(Executor.class);
private static PooledExecutor executor = new PooledExecutor(5);
static {
executor.setMinimumPoolSize(2);
executor.setMaximumPoolSize(10);
executor.setKeepAliveTime(1000 * 60 * 10);
}
public static void execute(Runnable runnable) {
try {
executor.execute(runnable);
}
catch (Exception e) {
logger.error("Exception while running task: " + e, e);
}
}
}</pre>
本文由用戶 fmms 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!