From c8d1dfebab902f4372a924f507b8cc00653ce55c Mon Sep 17 00:00:00 2001 From: dugenkui03 Date: Sat, 16 Apr 2022 21:21:18 +0800 Subject: [PATCH 1/2] Make event handling in JobExecutionExitCodeGenerator thread-safe See gh-30705 --- .../autoconfigure/batch/JobExecutionExitCodeGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java index 28f2d3b1415..cd5ce6e5118 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java @@ -16,8 +16,8 @@ package org.springframework.boot.autoconfigure.batch; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import org.springframework.batch.core.JobExecution; import org.springframework.boot.ExitCodeGenerator; @@ -31,7 +31,7 @@ import org.springframework.context.ApplicationListener; */ public class JobExecutionExitCodeGenerator implements ApplicationListener, ExitCodeGenerator { - private final List executions = new ArrayList<>(); + private final List executions = new CopyOnWriteArrayList<>(); @Override public void onApplicationEvent(JobExecutionEvent event) { From 026b9e2efee60c2f2f124b0ca4cd1e957b0dded1 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 3 May 2022 13:49:12 +0100 Subject: [PATCH 2/2] Polish "Make event handling in JobExecutionExitCodeGenerator thread-safe" See gh-30705 --- .../boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java index cd5ce6e5118..c2038935ab2 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobExecutionExitCodeGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.