java - Don't understand some behaviour of @async -


i'm having difficulty understanding aspect of @async annotation, , possibly workings of threads , threadpooling whole. when set in spring configuration file:

<task:executor id="whifexecutor" pool-size="10"/> <task:annotation-driven executor="whifexecutor" /> 

wouldn't mean 10 threads started? yet when run function has @async 1000 times continues rest of code after call (a simple message shown in console show number of times function has been called). after while pooled functions start return values, strangely enough 1 pool , 10 distinct threads. going on here? how can call 1000 functions yet use 10 threads? maybe put of them on stack before starting threads? tried reading documentation on couldn't find phenomenon.

also, there way make wait threads start running don't make call couple thousand functions @ once?

does maybe put of them on stack before starting threads?

not stack, queue.

the executor allocated 10 threads. if 10 threads busy, , new tasks added, added queue, , executed in turn. no more 10 tasks executed @ 1 time.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -