Skip to content

Commit

Permalink
Resurrect Micronaut 3 code line. Integrate latest Micronaut 3.x and C…
Browse files Browse the repository at this point in the history
…oherence CE 22.06 bits.
  • Loading branch information
rlubke committed Mar 25, 2024
1 parent ab74785 commit 515b90a
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 21 deletions.
18 changes: 18 additions & 0 deletions coherence-bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,21 @@ plugins {
id "io.micronaut.build.internal.coherence-base"
id 'io.micronaut.build.internal.bom'
}

javaPlatform {
allowDependencies()
}

micronautBom {
suppressions {
dependencies.addAll([
"io.micronaut.coherence:micronaut-coherence-data:${projectVersion}",
"io.micronaut.coherence:micronaut-coherence-grpc-test:${projectVersion}",
"io.micronaut.coherence:micronaut-coherence-cache:${projectVersion}",
"io.micronaut.coherence:micronaut-coherence-grpc-client:${projectVersion}",
"io.micronaut.coherence:micronaut-coherence-distributed-configuration:${projectVersion}",
"io.micronaut.coherence:micronaut-coherence:${projectVersion}",
"io.micronaut.coherence:micronaut-coherence-session:${projectVersion}"
])
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates.
* Copyright (c) 2020, 2024 Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
Expand All @@ -10,6 +10,7 @@
import java.util.Map;

import com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache;
import com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.partitionedCache.Storage;
import com.tangosol.coherence.component.util.safeService.SafeCacheService;
import com.tangosol.net.CacheService;
import com.tangosol.net.NamedMap;
Expand All @@ -26,37 +27,37 @@ private EventsHelper() {
}

public static int getTotalListenerCount(NamedMap<?, ?> map) {
PartitionedCache.Storage storage = getStorage(map);
Storage storage = getStorage(map);
return getKeyListenerCount(storage) + getListenerCount(storage);
}

public static int getListenerCount(NamedMap<?, ?> map) {
PartitionedCache.Storage storage = getStorage(map);
Storage storage = getStorage(map);
return getListenerCount(storage);
}

public static int getKeyListenerCount(NamedMap<?, ?> map) {
PartitionedCache.Storage storage = getStorage(map);
Storage storage = getStorage(map);
return getKeyListenerCount(storage);
}

private static int getListenerCount(PartitionedCache.Storage storage) {
private static int getListenerCount(Storage storage) {
if (storage == null) {
return 0;
}
Map<?, ?> map = storage.getListenerMap();
return map != null ? map.size() : 0;
}

private static int getKeyListenerCount(PartitionedCache.Storage storage) {
private static int getKeyListenerCount(Storage storage) {
if (storage == null) {
return 0;
}
Map<?, ?> map = storage.getKeyListenerMap();
return map != null ? map.size() : 0;
}

private static PartitionedCache.Storage getStorage(NamedMap<?, ?> map) {
private static Storage getStorage(NamedMap<?, ?> map) {
CacheService service = map.getService();
if (service instanceof SafeCacheService) {
service = ((SafeCacheService) service).getRunningCacheService();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2021 original authors
* Copyright 2017-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,6 +31,7 @@
import com.tangosol.internal.net.topic.impl.paged.model.SubscriberGroupId;
import com.tangosol.io.Serializer;
import com.tangosol.net.CacheService;
import com.tangosol.net.PagedTopicService;
import com.tangosol.net.topic.Position;
import com.tangosol.util.Binary;
import com.tangosol.util.ExternalizableHelper;
Expand Down Expand Up @@ -326,7 +327,7 @@ public void shouldReceiveMessagesForMultipleSubscribersInSameGroup() {
@Test
public void shouldCommitWithDefaultStrategy() throws Exception {
NamedTopic<String> topic = coherence.getSession().getTopic("TwentyDefault");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService(), null);
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (PagedTopicService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);

try (Publisher<String> publisher = topic.createPublisher()) {
Expand All @@ -342,7 +343,7 @@ public void shouldCommitWithDefaultStrategy() throws Exception {
@Test
public void shouldCommitWithSyncStrategy() throws Exception {
NamedTopic<String> topic = coherence.getSession().getTopic("TwentySync");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService(), null);
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (PagedTopicService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);

try (Publisher<String> publisher = topic.createPublisher()) {
Expand All @@ -358,7 +359,7 @@ public void shouldCommitWithSyncStrategy() throws Exception {
@Test
public void shouldCommitWithAsyncStrategy() {
NamedTopic<String> topic = coherence.getSession().getTopic("TwentyAsync");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService(), null);
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (PagedTopicService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);

try (Publisher<String> publisher = topic.createPublisher()) {
Expand All @@ -374,7 +375,7 @@ public void shouldCommitWithAsyncStrategy() {
@Test
public void shouldCommitWithManualStrategy() throws Exception {
NamedTopic<String> topic = coherence.getSession().getTopic("TwentyManual");
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (CacheService) topic.getService(), null);
PagedTopicCaches caches = new PagedTopicCaches(topic.getName(), (PagedTopicService) topic.getService());
SubscriberGroupId groupId = SubscriberGroupId.withName(ListenerSix.GROUP_ID);

try (Publisher<String> publisher = topic.createPublisher()) {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
projectVersion=3.7.2
projectVersion=3.10.0
projectGroup=io.micronaut.coherence
micronautDocsVersion=2.0.0
groovyVersion=3.0.13
Expand All @@ -28,7 +28,7 @@ developers=Aleks Seovic, Jonathan Knight, Vaso Putica, Ryan Lubke
githubBranch=master

# Micronaut core branch for BOM pull requests
githubCoreBranch=3.7.x
githubCoreBranch=3.10.x

bomProperty=micronautCoherenceVersion
# If needed, set additional properties
Expand Down
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
managed-coherence = "22.06.2"
managed-coherence = "22.06.7"

bedrock = "7.0.0"
hamcrest = "2.2"
Expand All @@ -8,13 +8,13 @@ junit = "5.9.1"
mockito = "4.8.1"

# Micronaut
micronaut = "3.7.3"
micronaut-grpc = "3.3.1"
micronaut = "3.10.4"
micronaut-grpc = "3.6.0"
micronaut-cache = "3.5.0"
micronaut-data = "3.8.1"
micronaut-discovery-client = "3.2.0"
micronaut-data = "3.9.7"
micronaut-discovery-client = "3.3.1"
micronaut-docs-asciidoc-config-props = "2.0.0"
micronaut-test = "3.7.0"
micronaut-test = "3.9.2"
micronaut-test-junit5 = "3.1.1"


Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pluginManagement {
}

plugins {
id("io.micronaut.build.shared.settings") version "5.3.15"
id("io.micronaut.build.shared.settings") version "5.4.10"
}

include 'coherence'
Expand Down

0 comments on commit 515b90a

Please sign in to comment.