From 48e300d2d8061c4ccd33004dfaba4970005aa24a Mon Sep 17 00:00:00 2001 From: Michael Minella Date: Mon, 30 Oct 2017 13:42:10 -0500 Subject: [PATCH] Polish --- spring-batch-docs/asciidoc/scalability.adoc | 46 +++++++++++++++------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/spring-batch-docs/asciidoc/scalability.adoc b/spring-batch-docs/asciidoc/scalability.adoc index 29050b670..8829b09d8 100644 --- a/spring-batch-docs/asciidoc/scalability.adoc +++ b/spring-batch-docs/asciidoc/scalability.adoc @@ -67,7 +67,7 @@ public Step sampleStep(TaskExecutor taskExecutor) { .chunk(10) .reader(itemReader()) .writer(itemWriter()) - .taskExecutor(taskExecutor()) + .taskExecutor(taskExecutor) .build(); } ---- @@ -88,7 +88,7 @@ thread pool), there is a throttle limit in the tasklet configuration which defau You may need to increase this to ensure that a thread pool is fully utilized. [role="xmlContent"] -For example you might increase threads, as shown in the following example: +For example you might increase the throttle-limit, as shown in the following example: [source, xml, role="xmlContent"] ---- @@ -99,17 +99,20 @@ For example you might increase threads, as shown in the following example: ---- [role="javaContent"] -When using java configuration, threads can be increased on the `TaskExecutor`, -as shown in the following example: +When using java configuration, the builders provide access to the throttle limit: .Java Configuration [source, java, role="javaContent"] ---- @Bean -public TaskExecutor taskExecutor(){ - SimpleAsyncTaskExecutor asyncTaskExecutor=new SimpleAsyncTaskExecutor("spring_batch"); - asyncTaskExecutor.setConcurrencyLimit(20); - return asyncTaskExecutor; +public Step sampleStep(TaskExecutor taskExecutor) { + return this.stepBuilderFactory.get("sampleStep") + .chunk(10) + .reader(itemReader()) + .writer(itemWriter()) + .taskExecutor(taskExecutor) + .throttleLimit(20) + .build(); } ---- @@ -214,13 +217,13 @@ public TaskExecutor taskExecutor(){ } ---- -The configurable "task-executor" attribute is used to specify which `TaskExecutor` +The configurable task executor is used to specify which `TaskExecutor` implementation should be used to execute the individual flows. The default is `SyncTaskExecutor`, but an asynchronous `TaskExecutor` is required to run the steps in parallel. Note that the job ensures that every flow in the split completes before aggregating the exit statuses and transitioning. -See the section on <> for moredetail. +See the section on <> for more detail. [[remoteChunking]] @@ -252,6 +255,10 @@ The middleware has to be durable, with guaranteed delivery and a single consumer message. JMS is the obvious candidate, but other options (such as Java Spaces exist in the grid computing and shared memory product space. +See the section on +<> +for more detail. + [[partitioning]] === Partitioning @@ -463,10 +470,25 @@ the `Partitioner` output might resemble the content of the following table: Then the file name can be bound to a step using late binding to the execution context, as shown in the following example: -[source, xml] +.XML Configuration +[source, xml, role="xmlContent"] ---- - + ---- + +.Java Configuration +[source, java, role="javaContent"] +---- +@Bean +public MultiResourceItemReader itemReader( + @Value("#{stepExecutionContext['fileName']}/*") Resource [] resources) { + return new MultiResourceItemReaderBuilder() + .delegate(fileReader()) + .name("itemReader") + .resources(resources) + .build(); +} +----