using6
附录一创造100条线,每个线上完成一项任务。 我想不断走10条路。 这意味着,如果我正在接近1-10,而且已经读完8篇,我就希望能够在11条之后开始,而不必等待1-10条加入。
How can I do this?
这方面的一个途径可能是使用Alive(Alive()方法,但我很想知道,我是否能够在没有投票的情况下这样做。
Thanks.
using6
附录一创造100条线,每个线上完成一项任务。 我想不断走10条路。 这意味着,如果我正在接近1-10,而且已经读完8篇,我就希望能够在11条之后开始,而不必等待1-10条加入。
How can I do this?
这方面的一个途径可能是使用Alive(Alive()方法,但我很想知道,我是否能够在没有投票的情况下这样做。
Thanks.
为什么需要这样做?
更好的办法是建立10座read,并向它提交100项任务。 这将产生完全相同的效果——100项任务中有10项同时执行。
ExecutorService pool = Executors.newFixedThreadPool(10);
for (int i = 0; i < 100; i++)
pool.submit(...);
使用Executorservice,配对10thread to submitting mandate。 您总结的任何工作都将在奎埃完成,10个read子将从那里完成1,000个工作。
When you say "at a time" while talking about concurrency is Confusing. If you use a ExecuterService with thread pool size of 10, 10 out of 100 threads will be enabled for execution. But remember if you have only 1 CPU and one of your thread has higher priority, all other threads may stay in waiting state. My suggestion is to tune your number threads based on the number of CPU available.
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...