我从jetlang开始,基本样本非常清楚.我没有找到的是使用PoolFiber的好样本.有没有人玩过这个?我也阅读了retlang样本,但似乎有点不同.
谢谢你分享你的想法!
狼
小智 5
使用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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1801 次 |
| 最近记录: |