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 11/*
2- * Copyright 2014-2022 the original author or authors.
2+ * Copyright 2014-2023 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
2020import java .util .Map ;
2121
2222import reactor .core .publisher .Mono ;
23+ import reactor .core .scheduler .Schedulers ;
2324
2425import org .springframework .session .events .SessionDeletedEvent ;
2526import org .springframework .session .events .SessionExpiredEvent ;
3738 * </p>
3839 *
3940 * @author Rob Winch
41+ * @author Yanming Zhou
4042 * @since 2.0
4143 */
4244public class ReactiveMapSessionRepository implements ReactiveSessionRepository <MapSession > {
@@ -98,11 +100,17 @@ public Mono<Void> deleteById(String id) {
98100
99101 @ Override
100102 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
106114 }
107115
108116 /**
You can’t perform that action at this time.
0 commit comments