Skip to content

Commit a8f9651

Browse files
committed
spring-projectsGH-3869: Implement requested changes in the advice during review.
1 parent 6c5bd49 commit a8f9651

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/ContextHolderRequestHandlerAdvice.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,31 +87,17 @@ public void setContextClearHook(Consumer<Object> contextClearHook) {
8787

8888
@Override
8989
protected Object doInvoke(ExecutionCallback callback, Object target, Message<?> message) {
90-
final var result = callback.execute();
9190
applyKeyProvider(message);
92-
return result;
91+
return callback.execute();
9392
}
9493

9594
private void applyKeyProvider(Message<?> message) {
96-
if (this.keyProvider != null) {
97-
final Object key = this.keyProvider.apply(message);
98-
if (key != null) {
99-
setContext(key);
100-
clearContext(key);
101-
}
102-
}
95+
final Object key = this.keyProvider.apply(message);
96+
setContext(key);
10397
}
10498

10599
private void setContext(Object key) {
106-
if (this.contextSetHook != null) {
107-
this.contextSetHook.accept(key);
108-
}
109-
}
110-
111-
private void clearContext(Object key) {
112-
if (this.contextClearHook != null) {
113-
this.contextClearHook.accept(key);
114-
}
100+
this.contextSetHook.accept(key);
115101
}
116102

117103
}

0 commit comments

Comments
 (0)