Skip to content

Commit

Permalink
feat: add maven profiles for Infinispan 14 (#131)
Browse files Browse the repository at this point in the history
* feat: add maven profiles for Infinispan 14

* feat: bump ISPN version to 14.0.14.Final

* fix: unknown enum constant warning

Without this dependency a warning occurs during the build process.

* docs: describe how to use a different ISPN version

Without this dependency a warning occurs during the build process.
  • Loading branch information
pk-work authored Aug 28, 2023
1 parent 5ea738f commit 2d36fd9
Show file tree
Hide file tree
Showing 10 changed files with 374 additions and 6 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci-4.x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ jobs:
with:
name: heap-dump
path: target/*.hprof
Test-ISPN14:
name: Run tests
strategy:
matrix:
os: [ ubuntu-latest ]
jdk: [ 11 ]
profile: [ISPN-14, ISPN-14-jakarta]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.jdk }}
distribution: temurin
- name: Run tests
run: mvn -P ${{ matrix.profile }} -s .github/maven-ci-settings.xml -B -DtestLogLevel=OFF test
Deploy:
name: Deploy to OSSRH
if: ${{ github.repository_owner == 'vert-x3' && (github.event_name == 'push' || github.event_name == 'schedule') }}
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<doc.skip>true</doc.skip>
<rxjava3.version>3.0.13</rxjava3.version>
<infinispan.version>13.0.17.Final</infinispan.version>
<infinispan.jakartasuffix></infinispan.jakartasuffix>
</properties>

<dependencyManagement>
Expand Down
34 changes: 32 additions & 2 deletions vertx-infinispan/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
<artifactId>infinispan-core${infinispan.jakartasuffix}</artifactId>
<version>${infinispan.version}</version>
<exclusions>
<exclusion>
Expand All @@ -67,7 +67,7 @@
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-multimap</artifactId>
<artifactId>infinispan-multimap${infinispan.jakartasuffix}</artifactId>
<version>${infinispan.version}</version>
</dependency>
<!-- Same version as Camel 3 -->
Expand All @@ -92,11 +92,28 @@
<groupId>org.infinispan</groupId>
<artifactId>infinispan-clustered-lock</artifactId>
<version>${infinispan.version}</version>
<exclusions>
<exclusion>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-clustered-counter</artifactId>
<version>${infinispan.version}</version>
<exclusions>
<exclusion>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-component-annotations</artifactId>
<version>${infinispan.version}</version>
</dependency>
<!-- Same version as vertx-rx-java3 -->
<dependency>
Expand Down Expand Up @@ -271,6 +288,19 @@
</build>

<profiles>
<profile>
<id>ISPN-14</id>
<properties>
<infinispan.version>14.0.14.Final</infinispan.version>
</properties>
</profile>
<profile>
<id>ISPN-14-jakarta</id>
<properties>
<infinispan.version>14.0.14.Final</infinispan.version>
<infinispan.jakartasuffix>-jakarta</infinispan.jakartasuffix>
</properties>
</profile>
<profile>
<id>coverage</id>
<build>
Expand Down
104 changes: 104 additions & 0 deletions vertx-infinispan/src/main/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -432,3 +432,107 @@ After creation, the health check can be exposed over HTTP with a link:../../vert
----
{@link examples.Examples#healthCheckHandler(io.vertx.core.Vertx, io.vertx.ext.healthchecks.HealthChecks)}
----

== Using a different Infinispan version

Switching the version to Infinispan 14 or Infinispan 14 Jakarta requires Java 11.

=== Switch to Infinispan 14

In order to use Infinispan 14 you need to upgrade all Infinispan related packages.

Maven:
----
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-bom</artifactId>
<version>14.0.14.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
----

Gradle:
----
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'org.infinispan') {
details.useVersion '14.0.14.Final'
}
}
}
----

=== Switch to Infinispan 14 Jakarta

In order to use Infinispan 14 you need to upgrade all Infinispan related packages and replace some jakarta specific artifacts.

Maven:
----
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-bom</artifactId>
<version>14.0.14.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core-jakarta</artifactId>
</dependency>
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-multimap-jakarta</artifactId>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-infinispan</artifactId>
<exclusions>
<exclusion>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-multimap</artifactId>
</exclusion>
<exclusion>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-commons</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
----

Gradle:
----
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'org.infinispan') {
details.useVersion '14.0.14.Final'
}
}
}
dependencies {
implementation (group: '${maven.groupId}', name: '${maven.artifactId}', version: '${maven.version}') {
exclude group: 'org.infinispan', module: 'infinispan-core'
exclude group: 'org.infinispan', module: 'infinispan-commons'
exclude group: 'org.infinispan', module: 'infinispan-multimap'
}
implementation group: 'org.infinispan', name: 'infinispan-multimap-jakarta', version: '14.0.14.Final'
implementation group: 'org.infinispan', name: 'infinispan-core-jakarta', version: '14.0.14.Final'
}
----
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.infinispan.commons.api.CacheContainerAdmin;
import org.infinispan.commons.util.FileLookup;
import org.infinispan.commons.util.FileLookupFactory;
import org.infinispan.commons.util.Version;
import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
import org.infinispan.configuration.parsing.ParserRegistry;
import org.infinispan.context.Flag;
Expand Down Expand Up @@ -72,11 +73,12 @@ public class InfinispanClusterManager implements ClusterManager {

private static final Logger log = LoggerFactory.getLogger(InfinispanClusterManager.class);

private static final boolean isISPN13 = "13".equals(Version.getMajor());
private static final String VERTX_INFINISPAN_CONFIG_PROP_NAME = "vertx.infinispan.config";
private static final String INFINISPAN_XML = "infinispan.xml";
private static final String DEFAULT_INFINISPAN_XML = "default-infinispan.xml";
private static final String DEFAULT_INFINISPAN_XML = isISPN13 ? "default-infinispan.xml" : "default-infinispan-14.xml";
private static final String VERTX_JGROUPS_CONFIG_PROP_NAME = "vertx.jgroups.config";
private static final String JGROUPS_XML = "jgroups.xml";
private static final String JGROUPS_XML = isISPN13 ? "jgroups.xml" : "jgroups-5.xml";

private final String ispnConfigPath;
private final String jgroupsConfigPath;
Expand Down Expand Up @@ -119,6 +121,7 @@ public InfinispanClusterManager(DefaultCacheManager cacheManager) {

@Override
public void init(Vertx vertx, NodeSelector nodeSelector) {
log.info("Cluster Manager is using Infinispan " + Version.getVersion());
this.vertx = (VertxInternal) vertx;
this.nodeSelector = nodeSelector;
}
Expand Down
35 changes: 35 additions & 0 deletions vertx-infinispan/src/main/resources/default-infinispan-14.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2022 Red Hat, Inc.
~
~ Red Hat licenses this file to you under the Apache License, version 2.0
~ (the "License"); you may not use this file except in compliance with the
~ License. You may obtain a copy of the License at:
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
-->

<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:14.0 http://www.infinispan.org/schemas/infinispan-config-14.0.xsd"
xmlns="urn:infinispan:config:14.0">

<jgroups>
<stack-file name="jgroups" path="tcp.xml"/>
</jgroups>

<cache-container default-cache="distributed-cache">
<transport stack="jgroups"/>
<distributed-cache name="distributed-cache"/>
<replicated-cache name="__vertx.subs"/>
<replicated-cache name="__vertx.haInfo"/>
<replicated-cache name="__vertx.nodeInfo"/>
<distributed-cache-configuration name="__vertx.distributed.cache.configuration"/>
</cache-container>

</infinispan>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.vertx.core.*;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.ext.cluster.infinispan.InfinispanClusterManager;
import org.infinispan.commons.util.Version;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;

Expand Down Expand Up @@ -68,11 +69,12 @@ protected ClusterManager getClusterManager() {

@Override
protected List<String> getExternalNodeSystemProperties() {
String jgroupsVersion = Version.getMajor().equals(13) ? "" : "-5";
return Arrays.asList(
"-Djava.net.preferIPv4Stack=true",
"-Djgroups.join_timeout=1000",
"-Dvertx.infinispan.config=infinispan.xml",
"-Dvertx.jgroups.config=jgroups.xml",
"-Dvertx.jgroups.config=jgroups"+ jgroupsVersion + ".xml",
"-Djgroups.file.location=" + System.getProperty("jgroups.file.location"),
"-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory"
);
Expand Down
71 changes: 71 additions & 0 deletions vertx-infinispan/src/test/resources/jgroups-5.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!--
~ Copyright 2022 Red Hat, Inc.
~
~ Red Hat licenses this file to you under the Apache License, version 2.0
~ (the "License"); you may not use this file except in compliance with the
~ License. You may obtain a copy of the License at:
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
~ License for the specific language governing permissions and limitations
~ under the License.
-->

<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups-5.2.xsd">
<!-- jgroups.tcp.address is deprecated and will be removed, see ISPN-11867 -->
<TCP bind_addr="${jgroups.bind.address,jgroups.tcp.address:SITE_LOCAL}"
bind_port="${jgroups.bind.port,jgroups.tcp.port:7800}"
thread_naming_pattern="pl"
send_buf_size="640k"
sock_conn_timeout="300"
bundler_type="transfer-queue"

thread_pool.min_threads="${jgroups.thread_pool.min_threads:0}"
thread_pool.max_threads="${jgroups.thread_pool.max_threads:200}"
thread_pool.keep_alive_time="60000"
/>
<FILE_PING location="${jgroups.file.location}"
register_shutdown_hook="false"
/>
<MERGE3 min_interval="10000"
max_interval="30000"
/>
<FD_SOCK/>
<!-- Suspect node `timeout` to `timeout + timeout_check_interval` millis after the last heartbeat -->
<FD_ALL timeout="10000"
interval="2000"
timeout_check_interval="1000"
/>
<VERIFY_SUSPECT timeout="1000"/>
<pbcast.NAKACK2 use_mcast_xmit="false"
xmit_interval="200"
xmit_table_num_rows="50"
xmit_table_msgs_per_row="1024"
xmit_table_max_compaction_time="30000"
resend_last_seqno="true"
/>
<UNICAST3 conn_close_timeout="5000"
xmit_interval="200"
xmit_table_num_rows="50"
xmit_table_msgs_per_row="1024"
xmit_table_max_compaction_time="30000"
/>
<pbcast.STABLE desired_avg_gossip="5000"
max_bytes="1M"
/>
<pbcast.GMS print_local_addr="false"
join_timeout="${jgroups.join_timeout:2000}"
/>
<UFC max_credits="4m"
min_threshold="0.40"
/>
<MFC max_credits="4m"
min_threshold="0.40"
/>
<FRAG3/>
</config>
Loading

0 comments on commit 2d36fd9

Please sign in to comment.