Java并发开发包 util.concurrent
fmms
13年前
util.concurrent 是一个 Java 语言的并发开发包,这个类库由以下接口实现组: <br /> <ul> <li><code>Sync</code> -- locks, conditions </li> <li><code>Channel</code> -- queues, buffers </li> <li><code>Barrier</code> -- multi-party synchronization </li> <li><code>SynchronizedVariable</code> -- atomic ints, refs etc </li> <li><code>java.util.Collection</code> -- collections </li> <li><code>Executor</code> -- replacements for direct use of Thread </li> </ul> 示例代码: <pre class="brush:java; toolbar: true; auto-links: false;">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> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326804057655" target="_blank">http://www.open-open.com/lib/view/home/1326804057655</a></p>