Skip to content

Commit 9041ffb

Browse files
vpavicrwinch
authored andcommitted
Remove deprecated code in spring-session-hazelcast
1 parent b20b08e commit 9041ffb

File tree

5 files changed

+3
-184
lines changed

5 files changed

+3
-184
lines changed

spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/HazelcastFlushMode.java

Lines changed: 0 additions & 57 deletions
This file was deleted.

spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/HazelcastSessionRepository.java

Lines changed: 0 additions & 60 deletions
This file was deleted.

spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/config/annotation/web/http/EnableHazelcastHttpSession.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2019 the original author or authors.
2+
* Copyright 2014-2022 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.
@@ -32,7 +32,6 @@
3232
import org.springframework.session.Session;
3333
import org.springframework.session.SessionRepository;
3434
import org.springframework.session.config.annotation.web.http.EnableSpringHttpSession;
35-
import org.springframework.session.hazelcast.HazelcastFlushMode;
3635
import org.springframework.session.web.http.SessionRepositoryFilter;
3736

3837
/**
@@ -85,21 +84,6 @@
8584
*/
8685
String sessionMapName() default "spring:session:sessions";
8786

88-
/**
89-
* Flush mode for the Hazelcast sessions. The default is {@code ON_SAVE} which only
90-
* updates the backing Hazelcast when {@link SessionRepository#save(Session)} is
91-
* invoked. In a web environment this happens just before the HTTP response is
92-
* committed.
93-
* <p>
94-
* Setting the value to {@code IMMEDIATE} will ensure that the any updates to the
95-
* Session are immediately written to the Hazelcast instance.
96-
* @return the {@link HazelcastFlushMode} to use
97-
* @since 1.3.0
98-
* @deprecated since 2.2.0 in favor of {@link #flushMode()}
99-
*/
100-
@Deprecated
101-
HazelcastFlushMode hazelcastFlushMode() default HazelcastFlushMode.ON_SAVE;
102-
10387
/**
10488
* Flush mode for the Hazelcast sessions. The default is {@code ON_SAVE} which only
10589
* updates the backing Hazelcast when {@link SessionRepository#save(Session)} is

spring-session-hazelcast/src/main/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfiguration.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2021 the original author or authors.
2+
* Copyright 2014-2022 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.
@@ -38,7 +38,6 @@
3838
import org.springframework.session.Session;
3939
import org.springframework.session.config.SessionRepositoryCustomizer;
4040
import org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration;
41-
import org.springframework.session.hazelcast.HazelcastFlushMode;
4241
import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository;
4342
import org.springframework.session.hazelcast.config.annotation.SpringSessionHazelcastInstance;
4443
import org.springframework.session.web.http.SessionRepositoryFilter;
@@ -86,11 +85,6 @@ public void setSessionMapName(String sessionMapName) {
8685
this.sessionMapName = sessionMapName;
8786
}
8887

89-
@Deprecated
90-
public void setHazelcastFlushMode(HazelcastFlushMode hazelcastFlushMode) {
91-
setFlushMode(hazelcastFlushMode.getFlushMode());
92-
}
93-
9488
public void setFlushMode(FlushMode flushMode) {
9589
this.flushMode = flushMode;
9690
}
@@ -127,7 +121,6 @@ public void setSessionRepositoryCustomizer(
127121
}
128122

129123
@Override
130-
@SuppressWarnings("deprecation")
131124
public void setImportMetadata(AnnotationMetadata importMetadata) {
132125
Map<String, Object> attributeMap = importMetadata
133126
.getAnnotationAttributes(EnableHazelcastHttpSession.class.getName());
@@ -137,12 +130,7 @@ public void setImportMetadata(AnnotationMetadata importMetadata) {
137130
if (StringUtils.hasText(sessionMapNameValue)) {
138131
this.sessionMapName = sessionMapNameValue;
139132
}
140-
FlushMode flushMode = attributes.getEnum("flushMode");
141-
HazelcastFlushMode hazelcastFlushMode = attributes.getEnum("hazelcastFlushMode");
142-
if (flushMode == FlushMode.ON_SAVE && hazelcastFlushMode != HazelcastFlushMode.ON_SAVE) {
143-
flushMode = hazelcastFlushMode.getFlushMode();
144-
}
145-
this.flushMode = flushMode;
133+
this.flushMode = attributes.getEnum("flushMode");
146134
this.saveMode = attributes.getEnum("saveMode");
147135
}
148136

spring-session-hazelcast/src/test/java/org/springframework/session/hazelcast/config/annotation/web/http/HazelcastHttpSessionConfigurationTests.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.springframework.session.SaveMode;
3535
import org.springframework.session.Session;
3636
import org.springframework.session.config.SessionRepositoryCustomizer;
37-
import org.springframework.session.hazelcast.HazelcastFlushMode;
3837
import org.springframework.session.hazelcast.HazelcastIndexedSessionRepository;
3938
import org.springframework.session.hazelcast.config.annotation.SpringSessionHazelcastInstance;
4039
import org.springframework.test.util.ReflectionTestUtils;
@@ -130,15 +129,6 @@ void customFlushImmediately() {
130129
assertThat(ReflectionTestUtils.getField(repository, "flushMode")).isEqualTo(FlushMode.IMMEDIATE);
131130
}
132131

133-
@Test
134-
void customFlushImmediatelyLegacy() {
135-
registerAndRefresh(CustomFlushImmediatelyLegacyConfiguration.class);
136-
137-
HazelcastIndexedSessionRepository repository = this.context.getBean(HazelcastIndexedSessionRepository.class);
138-
assertThat(repository).isNotNull();
139-
assertThat(ReflectionTestUtils.getField(repository, "flushMode")).isEqualTo(FlushMode.IMMEDIATE);
140-
}
141-
142132
@Test
143133
void setCustomFlushImmediately() {
144134
registerAndRefresh(BaseConfiguration.class, CustomFlushImmediatelySetConfiguration.class);
@@ -148,15 +138,6 @@ void setCustomFlushImmediately() {
148138
assertThat(ReflectionTestUtils.getField(repository, "flushMode")).isEqualTo(FlushMode.IMMEDIATE);
149139
}
150140

151-
@Test
152-
void setCustomFlushImmediatelyLegacy() {
153-
registerAndRefresh(BaseConfiguration.class, CustomFlushImmediatelySetLegacyConfiguration.class);
154-
155-
HazelcastIndexedSessionRepository repository = this.context.getBean(HazelcastIndexedSessionRepository.class);
156-
assertThat(repository).isNotNull();
157-
assertThat(ReflectionTestUtils.getField(repository, "flushMode")).isEqualTo(FlushMode.IMMEDIATE);
158-
}
159-
160141
@Test
161142
void customSaveModeAnnotation() {
162143
registerAndRefresh(BaseConfiguration.class, CustomSaveModeExpressionAnnotationConfiguration.class);
@@ -319,16 +300,6 @@ static class CustomFlushImmediatelySetConfiguration extends HazelcastHttpSession
319300

320301
}
321302

322-
@Configuration
323-
@SuppressWarnings("deprecation")
324-
static class CustomFlushImmediatelySetLegacyConfiguration extends HazelcastHttpSessionConfiguration {
325-
326-
CustomFlushImmediatelySetLegacyConfiguration() {
327-
setHazelcastFlushMode(HazelcastFlushMode.IMMEDIATE);
328-
}
329-
330-
}
331-
332303
@EnableHazelcastHttpSession(saveMode = SaveMode.ALWAYS)
333304
static class CustomSaveModeExpressionAnnotationConfiguration {
334305

@@ -349,13 +320,6 @@ static class CustomFlushImmediatelyConfiguration extends BaseConfiguration {
349320

350321
}
351322

352-
@Configuration
353-
@EnableHazelcastHttpSession(hazelcastFlushMode = HazelcastFlushMode.IMMEDIATE)
354-
@SuppressWarnings("deprecation")
355-
static class CustomFlushImmediatelyLegacyConfiguration extends BaseConfiguration {
356-
357-
}
358-
359323
@Configuration
360324
@EnableHazelcastHttpSession
361325
static class QualifiedHazelcastInstanceConfiguration extends BaseConfiguration {

0 commit comments

Comments
 (0)