Skip to content

Commit d94f799

Browse files
Bump com.hazelcast:hazelcast from 5.3.8 to 5.6.0 (#6802)
* Bump com.hazelcast:hazelcast from 5.3.8 to 5.6.0 Bumps [com.hazelcast:hazelcast](https://github.com/hazelcast/hazelcast) from 5.3.8 to 5.6.0. - [Release notes](https://github.com/hazelcast/hazelcast/releases) - [Commits](hazelcast/hazelcast@v5.3.8...v5.6.0) --- updated-dependencies: - dependency-name: com.hazelcast:hazelcast dependency-version: 5.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Use latest hazelcast in integration test only It requires Java 17. Use the last version that supported Java 11 when compiling against Hazelcast for our instrumentation and running our cache TCK. Also copies the TCK to the Hazelcast sample to run it against the latest Hazelcast version. * Add missing junit platform launcher runtime dependency --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tommy Ludwig <8924140+shakuzen@users.noreply.github.com>
1 parent ff9c25a commit d94f799

File tree

5 files changed

+134
-4
lines changed

5 files changed

+134
-4
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ grpcKotlin = "1.4.3"
2222
guava = "32.1.3-jre"
2323
guice = "5.1.0"
2424
h2 = "2.4.240"
25-
hazelcast = "5.3.8"
2625
hdrhistogram = "2.2.2"
2726
hibernate = "5.6.15.Final"
2827
# 2.6.0 requires JDK 11
@@ -117,7 +116,8 @@ grpcKotlinStub = { module = "io.grpc:grpc-kotlin-stub", version.ref = "grpcKotli
117116
guava = { module = "com.google.guava:guava", version.ref = "guava" }
118117
guice = { module = "com.google.inject:guice", version.ref = "guice" }
119118
h2 = { module = "com.h2database:h2", version.ref = "h2" }
120-
hazelcast = { module = "com.hazelcast:hazelcast", version.ref = "hazelcast" }
119+
# latest hazelcast version to run integration tests with
120+
hazelcast = { module = "com.hazelcast:hazelcast", version = "5.6.0" }
121121
hdrhistogram = { module = "org.hdrhistogram:HdrHistogram", version.ref = "hdrhistogram" }
122122
hibernateEntitymanager = { module = "org.hibernate:hibernate-entitymanager", version.ref = "hibernate" }
123123
hsqldb = { module = "org.hsqldb:hsqldb", version.ref = "hsqldb" }

micrometer-core/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ dependencies {
114114
optionalApi libs.caffeine
115115
optionalApi libs.ehcache2
116116
optionalApi libs.javax.cacheApi
117-
optionalApi libs.hazelcast
117+
// hard-coded to last hazelcast version to support Java 11
118+
optionalApi("com.hazelcast:hazelcast:5.3.8")
118119
optionalApi libs.hibernateEntitymanager
119120

120121
// server runtime monitoring

micrometer-test/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ dependencies {
3838
testImplementation libs.ehcache2
3939
testImplementation libs.javax.cacheApi
4040
testImplementation libs.jakarta.jmsApi
41-
testImplementation libs.hazelcast
41+
// hard-coded to last hazelcast version to support Java 11
42+
testImplementation("com.hazelcast:hazelcast:5.3.8")
4243
testImplementation libs.okhttp
4344
testImplementation libs.httpcomponents.client
4445
testImplementation libs.httpcomponents.async

samples/micrometer-samples-hazelcast/build.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,28 @@ plugins {
22
id 'java'
33
}
44

5+
// Latest version of Hazelcast requires Java 17
6+
if (!javaLanguageVersion.canCompileOrRun(17)) {
7+
project.tasks.configureEach { task -> task.enabled = false }
8+
}
9+
510
dependencies {
611
implementation project(':micrometer-core')
712
implementation libs.hazelcast
813
implementation libs.logback12
14+
15+
testImplementation(platform(libs.junitBom))
16+
testImplementation(project(":micrometer-test"))
17+
testImplementation(libs.junitJupiter)
18+
testRuntimeOnly(libs.junitPlatformLauncher)
19+
}
20+
21+
java {
22+
targetCompatibility = JavaVersion.VERSION_17
23+
}
24+
25+
compileJava {
26+
sourceCompatibility = JavaVersion.VERSION_17
27+
targetCompatibility = JavaVersion.VERSION_17
28+
options.release = 17
929
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
* Copyright 2017 VMware, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.micrometer.samples.hazelcast4;
17+
18+
import com.hazelcast.config.Config;
19+
import com.hazelcast.core.Hazelcast;
20+
import com.hazelcast.map.IMap;
21+
import io.micrometer.core.Issue;
22+
import io.micrometer.core.instrument.binder.cache.CacheMeterBinder;
23+
import io.micrometer.core.instrument.binder.cache.CacheMeterBinderCompatibilityKit;
24+
import io.micrometer.core.instrument.binder.cache.HazelcastCacheMetrics;
25+
import org.jspecify.annotations.Nullable;
26+
import org.junit.jupiter.api.AfterEach;
27+
import org.junit.jupiter.api.BeforeEach;
28+
import org.junit.jupiter.api.Disabled;
29+
import org.junit.jupiter.api.Test;
30+
31+
import static java.util.Collections.emptyList;
32+
import static org.assertj.core.api.Assertions.assertThat;
33+
34+
/**
35+
* Run the cache TCK against the latest version of Hazelcast.
36+
*/
37+
class HazelcastCacheMetricsCompatibilityTest extends CacheMeterBinderCompatibilityKit<Object> {
38+
39+
private Config config = new Config();
40+
41+
private IMap<String, String> cache;
42+
43+
@BeforeEach
44+
@SuppressWarnings("unchecked")
45+
void setup() {
46+
this.cache = (IMap<String, String>) super.cache;
47+
}
48+
49+
@Override
50+
@SuppressWarnings("NullAway")
51+
public void dereferenceCache() {
52+
super.dereferenceCache();
53+
this.cache.destroy();
54+
this.cache = null;
55+
}
56+
57+
@Disabled("This only demonstrates why we can't support miss count in Hazelcast.")
58+
@Issue("#586")
59+
@Test
60+
void multiInstanceMissCount() {
61+
IMap<String, String> cache2 = Hazelcast.newHazelcastInstance(config).getMap("mycache");
62+
63+
// Since each member owns 1/N (N being the number of members in the cluster)
64+
// entries of a distributed map,
65+
// we add two entries so we can deterministically say that each cache will "own"
66+
// one entry.
67+
cache.put("k1", "v");
68+
cache.put("k2", "v");
69+
70+
cache.get("k1");
71+
cache.get("k2");
72+
73+
// cache stats: hits = 1, gets = 2, puts = 2
74+
// cache2 stats: hits = 1, gets = 0, puts = 0
75+
76+
assertThat(cache.getLocalMapStats().getHits()).isEqualTo(1);
77+
assertThat(cache.getLocalMapStats().getGetOperationCount()).isEqualTo(2);
78+
assertThat(cache2.getLocalMapStats().getHits()).isEqualTo(1);
79+
80+
// ... and this is why we can't calculate miss count in Hazelcast. sorry!
81+
}
82+
83+
@AfterEach
84+
void cleanup() {
85+
Hazelcast.shutdownAll();
86+
}
87+
88+
@Override
89+
public IMap<String, String> createCache() {
90+
return Hazelcast.newHazelcastInstance(config).getMap("mycache");
91+
}
92+
93+
@Override
94+
public CacheMeterBinder<Object> binder() {
95+
return new HazelcastCacheMetrics(super.cache, emptyList());
96+
}
97+
98+
@Override
99+
public void put(String key, String value) {
100+
this.cache.put(key, value);
101+
}
102+
103+
@Override
104+
public @Nullable String get(String key) {
105+
return this.cache.get(key);
106+
}
107+
108+
}

0 commit comments

Comments
 (0)