<thread-pool>
Creates a thread pool (ExecutorService) with a default size of 4 threads and stores it in a request attribute named 'ConcurrentAttributes.EXECUTOR_SERVICE' by default. The task will wait for all tasks in the thread pool to complete before completing itself.
Use a <concurrent> task within this task.
| Name | XPath | Description | Reagent Type | Expected Type | Required |
|---|---|---|---|---|---|
| ATTRIBUTE_NAME | @attribute-name | Optional name under which the new ExecutorService will be registered as a request attribute. If omitted, the name 'ConcurrentAttributes.EXECUTOR_SERVICE' will be used. | PHRASE | java.lang.String | No |
| THREADS | @threads | Number of threads to use in the thread pool, defaults to 4. | PHRASE | java.lang.String | No |
| QUEUE_RATIO | @queue-ratio | Number of tasks to queue per thread, defaults to 10. | PHRASE | java.lang.String | No |
| USE_EXISTING | @use-existing | If true an ExecutorService that already exists for the specified attribute name will be used instead of creating a new ExecutorService. Defaults to false. | PHRASE | java.lang.String | No |
| SUBTASKS | * | The set of tasks that are children of this task. | NODE_LIST | java.util.List | No |
Creates an array of three URLs in JavaScript, then computes a checksum value ten times for one of the URLs in the array (distributed evenly) using a pool of five threads, writing the current count and checksum value to the console each time:
${num}=${checksum(${js(urls[num % 3])})}