Skip to content

Commit 38a87e0

Browse files
vpavicrwinch
authored andcommitted
Disable Hazelcast network join auto-detection in tests
At present, Hazelcast configurations used in tests disable multicast join but leave network join auto-detection enabled. This can cause issues with parallel test execution on machines that have bigger number of CPU cores/threads. This commit updates Hazelcast configurations used in tests to disable network join auto-detection and thus ensure no network join method ends up being enabled.
1 parent 75ab31d commit 38a87e0

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

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

Lines changed: 2 additions & 2 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.
@@ -45,7 +45,7 @@ static HazelcastInstance embeddedHazelcastServer() {
4545
Config config = new Config();
4646
NetworkConfig networkConfig = config.getNetworkConfig();
4747
networkConfig.setPort(0);
48-
networkConfig.getJoin().getMulticastConfig().setEnabled(false);
48+
networkConfig.getJoin().getAutoDetectionConfig().setEnabled(false);
4949
AttributeConfig attributeConfig = new AttributeConfig()
5050
.setName(HazelcastIndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
5151
.setExtractorClassName(PrincipalNameExtractor.class.getName());

spring-session-hazelcast/src/integration-test/resources/hazelcast-server.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<network>
77
<join>
8-
<multicast enabled="false"/>
8+
<auto-detection enabled="false"/>
99
</join>
1010
</network>
1111

spring-session-samples/spring-session-sample-boot-hazelcast/src/main/java/sample/config/SessionConfig.java

Lines changed: 2 additions & 2 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.
@@ -39,7 +39,7 @@ public Config hazelcastConfig() {
3939
Config config = new Config();
4040
NetworkConfig networkConfig = config.getNetworkConfig();
4141
networkConfig.setPort(0);
42-
networkConfig.getJoin().getMulticastConfig().setEnabled(false);
42+
networkConfig.getJoin().getAutoDetectionConfig().setEnabled(false);
4343
AttributeConfig attributeConfig = new AttributeConfig()
4444
.setName(HazelcastIndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
4545
.setExtractorClassName(PrincipalNameExtractor.class.getName());

spring-session-samples/spring-session-sample-javaconfig-hazelcast/src/main/java/sample/SessionConfig.java

Lines changed: 2 additions & 2 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.
@@ -40,7 +40,7 @@ public HazelcastInstance hazelcastInstance() {
4040
Config config = new Config();
4141
NetworkConfig networkConfig = config.getNetworkConfig();
4242
networkConfig.setPort(0);
43-
networkConfig.getJoin().getMulticastConfig().setEnabled(false);
43+
networkConfig.getJoin().getAutoDetectionConfig().setEnabled(false);
4444
AttributeConfig attributeConfig = new AttributeConfig()
4545
.setName(HazelcastIndexedSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
4646
.setExtractorClassName(PrincipalNameExtractor.class.getName());

spring-session-samples/spring-session-sample-misc-hazelcast/src/main/java/sample/Initializer.java

Lines changed: 2 additions & 2 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.
@@ -63,7 +63,7 @@ private HazelcastInstance createHazelcastInstance() {
6363
Config config = new Config();
6464
NetworkConfig networkConfig = config.getNetworkConfig();
6565
networkConfig.setPort(0);
66-
networkConfig.getJoin().getMulticastConfig().setEnabled(false);
66+
networkConfig.getJoin().getAutoDetectionConfig().setEnabled(false);
6767
config.getMapConfig(SESSION_MAP_NAME).setTimeToLiveSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS);
6868
return Hazelcast.newHazelcastInstance(config);
6969
}

0 commit comments

Comments
 (0)