Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Threadlocal.remove() instead of Threadlocal.set(null) #4601

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -35,6 +35,7 @@
* @author Dave Syer
* @author Michael Minella
* @author Mahmoud Ben Hassine
* @author Seungrae Kim
*
*/
public class JobFlowExecutor implements FlowExecutor {
Expand All @@ -58,7 +59,6 @@ public JobFlowExecutor(JobRepository jobRepository, StepHandler stepHandler, Job
this.jobRepository = jobRepository;
this.stepHandler = stepHandler;
this.execution = execution;
stepExecutionHolder.set(null);
}

@Override
Expand Down Expand Up @@ -118,7 +118,7 @@ public StepExecution getStepExecution() {

@Override
public void close(FlowExecution result) {
stepExecutionHolder.set(null);
stepExecutionHolder.remove();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -32,6 +32,7 @@
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
* @author Seungrae Kim
* @since 2.0
*/
public class ChunkMonitor extends ItemStreamSupport {
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -30,6 +30,7 @@
* {@link RepeatOperations} implementations.
*
* @author Dave Syer
* @author Seungrae Kim
*
*/
public final class RepeatSynchronizationManager {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down