Update to Vert.X 4.0.0

This commit is contained in:
Andrea Cavalli 2020-12-20 12:13:25 +01:00
parent 406905f241
commit 5d5d3c380a
2 changed files with 46 additions and 31 deletions

59
pom.xml
View File

@ -9,9 +9,11 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0-SNAPSHOT</revision> <revision>0-SNAPSHOT</revision>
<!-- required for jdk9 -->
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<vertx.version>4.0.0</vertx.version>
<junit-jupiter.version>5.4.0</junit-jupiter.version>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
@ -47,26 +49,51 @@
<developerConnection>scm:git:https://git.ignuranza.net/tdlight-team/tdlib-session-container.git</developerConnection> <developerConnection>scm:git:https://git.ignuranza.net/tdlight-team/tdlib-session-container.git</developerConnection>
<tag>HEAD</tag> <tag>HEAD</tag>
</scm> </scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-stack-depchain</artifactId>
<version>${vertx.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-core</artifactId>
<version>3.9.3</version>
</dependency>
<dependency> <dependency>
<groupId>io.vertx</groupId> <groupId>io.vertx</groupId>
<artifactId>vertx-hazelcast</artifactId> <artifactId>vertx-hazelcast</artifactId>
<version>3.9.3</version> <version>${vertx.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.vertx</groupId> <groupId>io.vertx</groupId>
<artifactId>vertx-reactive-streams</artifactId> <artifactId>vertx-junit5</artifactId>
<version>3.9.3</version> <version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.vertx</groupId> <groupId>io.vertx</groupId>
<artifactId>vertx-circuit-breaker</artifactId> <artifactId>vertx-circuit-breaker</artifactId>
<version>3.9.3</version> <version>${vertx.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.projectreactor</groupId> <groupId>io.projectreactor</groupId>
@ -120,18 +147,6 @@
<artifactId>fastutil</artifactId> <artifactId>fastutil</artifactId>
<version>8.3.1</version> <version>8.3.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>RELEASE</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>

View File

@ -1,13 +1,12 @@
package it.tdlight.tdlibsession.td.middle; package it.tdlight.tdlibsession.td.middle;
import com.hazelcast.config.Config; import com.hazelcast.config.Config;
import com.hazelcast.config.EvictionConfig;
import com.hazelcast.config.EvictionPolicy; import com.hazelcast.config.EvictionPolicy;
import com.hazelcast.config.GroupConfig;
import com.hazelcast.config.MapConfig; import com.hazelcast.config.MapConfig;
import com.hazelcast.config.MaxSizeConfig; import com.hazelcast.config.MaxSizePolicy;
import com.hazelcast.config.MaxSizeConfig.MaxSizePolicy;
import com.hazelcast.config.MergePolicyConfig; import com.hazelcast.config.MergePolicyConfig;
import com.hazelcast.config.SemaphoreConfig; import com.hazelcast.config.cp.SemaphoreConfig;
import io.vertx.core.DeploymentOptions; import io.vertx.core.DeploymentOptions;
import io.vertx.core.Handler; import io.vertx.core.Handler;
import io.vertx.core.Vertx; import io.vertx.core.Vertx;
@ -105,10 +104,12 @@ public class TdClusterManager {
.setBackupCount(1) .setBackupCount(1)
.setTimeToLiveSeconds(0) .setTimeToLiveSeconds(0)
.setMaxIdleSeconds(0) .setMaxIdleSeconds(0)
.setEvictionPolicy(EvictionPolicy.NONE) .setEvictionConfig(new EvictionConfig()
.setMaxSizeConfig(new MaxSizeConfig().setMaxSizePolicy(MaxSizePolicy.PER_NODE).setSize(0)) .setMaxSizePolicy(MaxSizePolicy.PER_NODE)
.setEvictionPolicy(EvictionPolicy.NONE)
.setSize(0))
.setMergePolicyConfig(new MergePolicyConfig().setPolicy("com.hazelcast.map.merge.LatestUpdateMapMergePolicy"))); .setMergePolicyConfig(new MergePolicyConfig().setPolicy("com.hazelcast.map.merge.LatestUpdateMapMergePolicy")));
cfg.setSemaphoreConfigs(Map.of("__vertx.*", new SemaphoreConfig().setInitialPermits(1))); cfg.getCPSubsystemConfig().setSemaphoreConfigs(Map.of("__vertx.*", new SemaphoreConfig().setInitialPermits(1)));
cfg.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false); cfg.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
cfg.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false); cfg.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
cfg.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true); cfg.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true);
@ -122,7 +123,7 @@ public class TdClusterManager {
cfg.setProperty("hazelcast.wait.seconds.before.join", "0"); cfg.setProperty("hazelcast.wait.seconds.before.join", "0");
cfg.setProperty("hazelcast.tcp.join.port.try.count", "5"); cfg.setProperty("hazelcast.tcp.join.port.try.count", "5");
cfg.setProperty("hazelcast.socket.bind.any", "false"); cfg.setProperty("hazelcast.socket.bind.any", "false");
cfg.setGroupConfig(new GroupConfig().setName("dev").setPassword("HzPasswordsAreDeprecated")); cfg.setClusterName("tdlib-session-container");
mgr = new HazelcastClusterManager(cfg); mgr = new HazelcastClusterManager(cfg);
vertxOptions.setClusterManager(mgr); vertxOptions.setClusterManager(mgr);
vertxOptions.getEventBusOptions().setConnectTimeout(120000); vertxOptions.getEventBusOptions().setConnectTimeout(120000);
@ -139,7 +140,6 @@ public class TdClusterManager {
} else { } else {
mgr = null; mgr = null;
vertxOptions.setClusterManager(null); vertxOptions.setClusterManager(null);
vertxOptions.getEventBusOptions().setClustered(false);
} }
return Mono return Mono