groovy – 什么是GPars默认池大小?
发布时间:2020-12-14 16:31:15 所属栏目:大数据 来源:网络整理
导读:我以为这会是一件容易的事情,但我失败了. 如果我在我的Groovy应用程序中使用GPars,并且我没有指定一个池大小将创建多少个线程?是否有默认池大小没有设置一个? // How many threads will be created? What is the default pool size?GParsExecutorsPool.wit
我以为这会是一件容易的事情,但我失败了.
如果我在我的Groovy应用程序中使用GPars,并且我没有指定一个池大小将创建多少个线程?是否有默认池大小没有设置一个? // How many threads will be created? What is the default pool size? GParsExecutorsPool.withPool { // do stuff... } 解决方法
它是(默认)设置为
private static int defaultPoolSize() { return Runtime.getRuntime().availableProcessors() + 1; } 您可以通过将名为gpars.poolsize的System属性设置为有效的整数来更改(我相信) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |