我从跳楼开始,基本的示例非常清楚。我没有发现的是一个使用PoolFiber的好示例。已经有人玩过了吗?我也读了雷朗的样本,但在那里似乎有点不同。
谢谢你分享你的想法!
冈美
发布于 2008-11-23 05:27:44
使用PoolFiber和ThreadFiber几乎是一样的。唯一的区别是线程池需要初始化并用于创建每个PoolFiber。
// create java thread pool.
ExecutorService pool = Executors.newCachedThreadPool();
//initialize factory with backing pool
PoolFiberFactory fiberFactory = new PoolFiberFactory(pool);
Fiber fiber = fiberFactory.create();
fiber.start();
//use fiber for normal publishing and subscribing.发布于 2014-04-05 08:15:57
它在吉特布身上。
https://github.com/jetlang/jetlang/blob/readme/src/test/java/org/jetlang/examples/BasicExamples.java
这里是mvn站点http://jetlang.github.io/jetlang/
发布于 2015-05-22 08:48:30
在涉及与JVM相关的CPU内核数量方面,一个比Cache更好的池是:
int availableProcessors = Runtime.getRuntime().availableProcessors();
int threadPoolSize = availableProcessors*2;
ThreadPoolExecutor POOL = new ThreadPoolExecutor(threadPoolSize,
threadPoolSize, 0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
PoolFiberFactory fiberFactory = new PoolFiberFactory(POOL);https://stackoverflow.com/questions/286848
复制相似问题