diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java index 9827040573..c1583e25f1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2022 the original author or authors. + * Copyright 2006-2024 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. @@ -35,6 +35,7 @@ * @author Dave Syer * @author Michael Minella * @author Mahmoud Ben Hassine + * @author Seungrae Kim * */ public class JobFlowExecutor implements FlowExecutor { @@ -58,7 +59,6 @@ public JobFlowExecutor(JobRepository jobRepository, StepHandler stepHandler, Job this.jobRepository = jobRepository; this.stepHandler = stepHandler; this.execution = execution; - stepExecutionHolder.set(null); } @Override @@ -118,7 +118,7 @@ public StepExecution getStepExecution() { @Override public void close(FlowExecution result) { - stepExecutionHolder.set(null); + stepExecutionHolder.remove(); } @Override diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java index ae83b261c3..47ac071075 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/ChunkMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2023 the original author or authors. + * Copyright 2006-2024 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. @@ -32,6 +32,7 @@ * * @author Dave Syer * @author Mahmoud Ben Hassine + * @author Seungrae Kim * @since 2.0 */ public class ChunkMonitor extends ItemStreamSupport { @@ -104,7 +105,7 @@ public void setChunkSize(int chunkSize) { @Override public void close() throws ItemStreamException { super.close(); - holder.set(null); + holder.remove(); if (streamsRegistered) { stream.close(); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatSynchronizationManager.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatSynchronizationManager.java index 8a809cfcae..c057138549 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatSynchronizationManager.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/repeat/support/RepeatSynchronizationManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007 the original author or authors. + * Copyright 2006-2024 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. @@ -30,6 +30,7 @@ * {@link RepeatOperations} implementations. * * @author Dave Syer + * @author Seungrae Kim * */ public final class RepeatSynchronizationManager { @@ -70,7 +71,7 @@ public static void setCompleteOnly() { */ public static RepeatContext register(RepeatContext context) { RepeatContext oldSession = getContext(); - RepeatSynchronizationManager.contextHolder.set(context); + contextHolder.set(context); return oldSession; } @@ -81,7 +82,7 @@ public static RepeatContext register(RepeatContext context) { */ public static RepeatContext clear() { RepeatContext context = getContext(); - RepeatSynchronizationManager.contextHolder.set(null); + contextHolder.remove(); return context; }