简体   繁体   English

如何从 java 更改 scala 中的 actor.maxPoolSize?

[英]How do I change actors.maxPoolSize in scala from java?

So I have two bash scripts.所以我有两个 bash 脚本。 One for calling the bytecode using the "scala" command, the other to call the same code using the "java" command.一个使用“scala”命令调用字节码,另一个使用“java”命令调用相同的代码。 My problem is the following, when I use scala, I can see that I can get about 80 threads ( which I created, and shows in my "Task Manager" ) while when I use the java command, I only get about 20 threads created.我的问题如下,当我使用 scala 时,我可以看到我可以获得大约 80 个线程(我创建并显示在我的“任务管理器”中),而当我使用 java 命令时,我只创建了大约 20 个线程. instead of 80. What is the equivalent "define" option under java for actors.corePoolSize and actors.maxPoolSize?而不是 80。对于actors.corePoolSize 和actors.maxPoolSize,java 下的等效“定义”选项是什么?

These are my bash scripts.这些是我的 bash 脚本。 The first has the following:第一个有以下内容:

JAVA_OPTS="-Xmx1g" scala -cp bin com.mcmc5.Main -Dactors.corePoolSize=60 -Dactors.maxPoolSize=5000

the second has:第二个有:

java -cp scala-library.jar:bin com.mcmc5.Main -Dactors.corePoolSize=60 -Dactors.maxPoolSize=5000 -Xmx1g

As far as I know, you can set System Properties in your application:据我所知,您可以在应用程序中设置系统属性:

System.setProperty("actors.minPoolSize" , numberOfActors)
System.setProperty("actors.maxPoolSize" , numberOfActors)
System.setProperty("actors.corePoolSize", numberOfActors)

The way you have defined your properties using java looks fine.您使用java定义属性的方式看起来不错。 Have you considered setting the actors.minPoolSize property?您是否考虑过设置actors.minPoolSize属性? This is exactly how I configure my actor-based applications.正是我配置基于参与者的应用程序的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM