Skip to content

Commit 2358014

Browse files
committed
Hazelcast4SessionUpdateEntryProcessor does not implement Offloadable
Closes gh-1707
1 parent e6e02de commit 2358014

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

spring-session-hazelcast/hazelcast4/src/integration-test/java/org/springframework/session/hazelcast/SessionEventHazelcast4IndexedSessionRepositoryTests.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import com.hazelcast.core.HazelcastInstance;
2323
import org.junit.jupiter.api.BeforeEach;
24-
import org.junit.jupiter.api.Disabled;
2524
import org.junit.jupiter.api.Test;
2625
import org.junit.jupiter.api.extension.ExtendWith;
2726

@@ -179,7 +178,6 @@ void changeSessionIdNoEventTest() throws InterruptedException {
179178
}
180179

181180
@Test // gh-1300
182-
@Disabled("See https://github.com/hazelcast/hazelcast/issues/16987")
183181
void updateMaxInactiveIntervalTest() throws InterruptedException {
184182
S sessionToSave = this.repository.createSession();
185183
sessionToSave.setMaxInactiveInterval(Duration.ofMinutes(30));

spring-session-hazelcast/hazelcast4/src/main/java/org/springframework/session/hazelcast/Hazelcast4SessionUpdateEntryProcessor.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
import java.time.Duration;
2020
import java.time.Instant;
2121
import java.util.Map;
22+
import java.util.concurrent.TimeUnit;
2223

23-
import com.hazelcast.core.Offloadable;
2424
import com.hazelcast.map.EntryProcessor;
25+
import com.hazelcast.map.ExtendedMapEntry;
2526

2627
import org.springframework.session.MapSession;
2728

@@ -32,7 +33,7 @@
3233
* @author Eleftheria Stein
3334
* @since 2.4.0
3435
*/
35-
public class Hazelcast4SessionUpdateEntryProcessor implements EntryProcessor<String, MapSession, Object>, Offloadable {
36+
public class Hazelcast4SessionUpdateEntryProcessor implements EntryProcessor<String, MapSession, Object> {
3637

3738
private Instant lastAccessedTime;
3839

@@ -62,15 +63,16 @@ public Object process(Map.Entry<String, MapSession> entry) {
6263
}
6364
}
6465
}
65-
entry.setValue(value);
66+
if (this.maxInactiveInterval != null) {
67+
((ExtendedMapEntry<String, MapSession>) entry).setValue(value, this.maxInactiveInterval.getSeconds(),
68+
TimeUnit.SECONDS);
69+
}
70+
else {
71+
entry.setValue(value);
72+
}
6673
return Boolean.TRUE;
6774
}
6875

69-
@Override
70-
public String getExecutorName() {
71-
return OFFLOADABLE_EXECUTOR;
72-
}
73-
7476
void setLastAccessedTime(Instant lastAccessedTime) {
7577
this.lastAccessedTime = lastAccessedTime;
7678
}

0 commit comments

Comments
 (0)