File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
spring-session-core/src/main/java/org/springframework/session Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2014-2022 the original author or authors.
2
+ * Copyright 2014-2023 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 .Map ;
21
21
22
22
import reactor .core .publisher .Mono ;
23
+ import reactor .core .scheduler .Schedulers ;
23
24
24
25
import org .springframework .session .events .SessionDeletedEvent ;
25
26
import org .springframework .session .events .SessionExpiredEvent ;
37
38
* </p>
38
39
*
39
40
* @author Rob Winch
41
+ * @author Yanming Zhou
40
42
* @since 2.0
41
43
*/
42
44
public class ReactiveMapSessionRepository implements ReactiveSessionRepository <MapSession > {
@@ -98,11 +100,17 @@ public Mono<Void> deleteById(String id) {
98
100
99
101
@ Override
100
102
public Mono <MapSession > createSession () {
101
- return Mono .defer (() -> {
102
- MapSession result = new MapSession (this .sessionIdGenerator );
103
- result .setMaxInactiveInterval (this .defaultMaxInactiveInterval );
104
- return Mono .just (result );
105
- });
103
+ // @formatter:off
104
+ return Mono .fromSupplier (() -> this .sessionIdGenerator .generate ())
105
+ .subscribeOn (Schedulers .boundedElastic ())
106
+ .publishOn (Schedulers .parallel ())
107
+ .map ((sessionId ) -> {
108
+ MapSession result = new MapSession (sessionId );
109
+ result .setMaxInactiveInterval (this .defaultMaxInactiveInterval );
110
+ result .setSessionIdGenerator (this .sessionIdGenerator );
111
+ return result ;
112
+ });
113
+ // @formatter:on
106
114
}
107
115
108
116
/**
You can’t perform that action at this time.
0 commit comments