Skip to content

Commit 75edb29

Browse files
committed
Update Javadocs about exception handling when closing composite streams
Related to #4764 and #4750
1 parent f40ab20 commit 75edb29

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/CompositeItemReader.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ public void update(ExecutionContext executionContext) throws ItemStreamException
7979
}
8080
}
8181

82+
/**
83+
* Close all delegates.
84+
* @throws ItemStreamException thrown if one of the delegates fails to close. Original
85+
* exceptions thrown by delegates are added as suppressed exceptions into this one, in
86+
* the same order as delegates were registered.
87+
*/
8288
@Override
8389
public void close() throws ItemStreamException {
8490
List<Exception> exceptions = new ArrayList<>();

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/CompositeItemStream.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ public void update(ExecutionContext executionContext) {
102102
/**
103103
* Broadcast the call to close.
104104
* @throws ItemStreamException thrown if one of the {@link ItemStream}s in the list
105-
* fails to close.
105+
* fails to close. Original exceptions thrown by delegates are added as suppressed
106+
* exceptions into this one, in the same order as delegates were registered.
106107
*/
107108
@Override
108109
public void close() throws ItemStreamException {

spring-batch-infrastructure/src/main/java/org/springframework/batch/item/support/CompositeItemWriter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ public void setDelegates(List<ItemWriter<? super T>> delegates) {
105105
this.delegates = delegates;
106106
}
107107

108+
/**
109+
* Close all delegates.
110+
* @throws ItemStreamException thrown if one of the delegates fails to close. Original
111+
* exceptions thrown by delegates are added as suppressed exceptions into this one, in
112+
* the same order as delegates were registered.
113+
*/
108114
@Override
109115
public void close() throws ItemStreamException {
110116
List<Exception> exceptions = new ArrayList<>();

0 commit comments

Comments
 (0)