File tree 1 file changed +6
-9
lines changed
spring-web/src/main/java/org/springframework/http/server/reactive
1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
20
20
import java .util .List ;
21
21
import java .util .concurrent .atomic .AtomicReference ;
22
22
import java .util .function .Supplier ;
23
- import java .util .stream .Collectors ;
24
23
25
24
import org .apache .commons .logging .Log ;
26
25
import org .reactivestreams .Publisher ;
@@ -215,23 +214,21 @@ protected Mono<Void> doCommit(@Nullable Supplier<? extends Mono<Void>> writeActi
215
214
if (!this .state .compareAndSet (State .NEW , State .COMMITTING )) {
216
215
return Mono .empty ();
217
216
}
218
-
219
217
this .commitActions .add (() ->
220
218
Mono .fromRunnable (() -> {
221
219
applyStatusCode ();
222
220
applyHeaders ();
223
221
applyCookies ();
224
222
this .state .set (State .COMMITTED );
225
223
}));
226
-
227
224
if (writeAction != null ) {
228
225
this .commitActions .add (writeAction );
229
226
}
230
-
231
- List <? extends Mono <Void >> actions = this .commitActions . stream ()
232
- . map ( Supplier :: get ). collect ( Collectors . toList ());
233
-
234
- return Flux . concat ( actions ) .then ();
227
+ Flux < Void > commit = Flux . empty ();
228
+ for ( Supplier <? extends Mono <Void >> actions : this .commitActions ) {
229
+ commit = commit . concatWith ( actions . get ());
230
+ }
231
+ return commit .then ();
235
232
}
236
233
237
234
You can’t perform that action at this time.
0 commit comments