I'm doing a server in java that wanted to perform certain tasks in parallel. I have a list of a certain type I want 20 threads to deal with deterimented list elements.
for( Item item : result ) {
Callable< List< IResult > > callable = new HTMLParser( item );
Future< List< IResult > > future = pool.submit( callable );
set.add( future );
}
for( Future< List< IResult > > future : set ) {
List< IResult > result = future.get( ); // wait for a processor to complete
if( result != null && !result.isEmpty( ) )
FResults.addAll( result );
}
}
But by running this solution, analyzing the logs it seems to me that it is running the threads sequentially
2016-12-06 14:17:02.106 DEBUG 18229 --- [pool-1-thread-5] ......
2016-12-06 14:17:02.106 DEBUG 18229 --- [pool-1-thread-5] ....
2016-12-06 14:17:02.106 DEBUG 18229 --- [pool-1-thread-5] .....
2016-12-06 14:17:02.106 DEBUG 18229 --- [pool-1-thread-5] .......
2016-12-06 14:17:02.106 INFO 18229 --- [pool-1-thread-5] .....
2016-12-06 14:17:02.243 DEBUG 18229 --- [ool-1-thread-19] .....
2016-12-06 14:17:02.243 INFO 18229 --- [ool-1-thread-19] ....
2016-12-06 14:17:02.587 DEBUG 18229 --- [ool-1-thread-16] .....
2016-12-06 14:17:02.587 DEBUG 18229 --- [ool-1-thread-16] ....
2016-12-06 14:17:02.587 DEBUG 18229 --- [ool-1-thread-16] .....
2016-12-06 14:17:02.587 DEBUG 18229 --- [ool-1-thread-16] .....
2016-12-06 14:17:02.588 DEBUG 18229 --- [ool-1-thread-16] .....
2016-12-06 14:17:02.588 DEBUG 18229 --- [ool-1-thread-16] ......
2016-12-06 14:17:02.588 DEBUG 18229 --- [ool-1-thread-16] .....
2016-12-06 14:17:02.588 DEBUG 18229 --- [ool-1-thread-16] ....
2016-12-06 14:17:02.588 DEBUG 18229 --- [ool-1-thread-16] ......
2016-12-06 14:17:02.588 DEBUG 18229 --- [ool-1-thread-16] ...
The uam thread logs appear sequentially all followed, does not make sense to me. Any ideas?