From cad03d0b410c83602359a1aeb75d524e5eaf599f Mon Sep 17 00:00:00 2001 From: "patrick.fry" Date: Sat, 4 Jan 2025 02:50:13 -0500 Subject: [PATCH] Bug 37237041 - [37193730->14.1.2.0.1] $SYS:Config:EventDispatcher throws NPE when coherence-mp-config used on storage-disabled node (14.1.2.0 cl 112539 --> ce/14.1.2.0) [git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v14.1.2.0/": change = 113177] --- .../net/events/internal/StorageDispatcher.java | 8 +++++++- .../cache/CacheLifecycleEventDispatcher.java | 13 +++++++++++-- .../common/GrpcCacheLifecycleEventDispatcher.java | 10 +++++++++- .../coherence/mp/config/CoherenceConfigSource.java | 10 +++++----- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/prj/coherence-core/src/main/java/com/tangosol/net/events/internal/StorageDispatcher.java b/prj/coherence-core/src/main/java/com/tangosol/net/events/internal/StorageDispatcher.java index 770b9cd8d8309..75dc30099dec0 100644 --- a/prj/coherence-core/src/main/java/com/tangosol/net/events/internal/StorageDispatcher.java +++ b/prj/coherence-core/src/main/java/com/tangosol/net/events/internal/StorageDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl. @@ -90,6 +90,12 @@ public String getCacheName() return f_sCacheName; } + @Override + public CacheService getCacheService() + { + return f_service; + } + @Override public String getServiceName() { diff --git a/prj/coherence-core/src/main/java/com/tangosol/net/events/partition/cache/CacheLifecycleEventDispatcher.java b/prj/coherence-core/src/main/java/com/tangosol/net/events/partition/cache/CacheLifecycleEventDispatcher.java index 8d74d8a537d3e..4a89ce789aa38 100644 --- a/prj/coherence-core/src/main/java/com/tangosol/net/events/partition/cache/CacheLifecycleEventDispatcher.java +++ b/prj/coherence-core/src/main/java/com/tangosol/net/events/partition/cache/CacheLifecycleEventDispatcher.java @@ -1,11 +1,13 @@ /* - * Copyright (c) 2020 Oracle and/or its affiliates. + * Copyright (c) 2020, 2025 Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at - * http://oss.oracle.com/licenses/upl. + * https://oss.oracle.com/licenses/upl. */ package com.tangosol.net.events.partition.cache; +import com.tangosol.net.CacheService; + import com.tangosol.net.events.EventDispatcher; /** @@ -34,6 +36,13 @@ public interface CacheLifecycleEventDispatcher */ public String getServiceName(); + /** + * Return the {@link CacheService} associated with this dispatcher. + * + * @return the {@link CacheService} + */ + public CacheService getCacheService(); + /** * Return the optional scope name that this dispatcher is associated with. * diff --git a/prj/coherence-grpc-client-common/src/main/java/com/oracle/coherence/grpc/client/common/GrpcCacheLifecycleEventDispatcher.java b/prj/coherence-grpc-client-common/src/main/java/com/oracle/coherence/grpc/client/common/GrpcCacheLifecycleEventDispatcher.java index ce7663c304fa2..af35809175499 100644 --- a/prj/coherence-grpc-client-common/src/main/java/com/oracle/coherence/grpc/client/common/GrpcCacheLifecycleEventDispatcher.java +++ b/prj/coherence-grpc-client-common/src/main/java/com/oracle/coherence/grpc/client/common/GrpcCacheLifecycleEventDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2024, Oracle and/or its affiliates. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl. @@ -7,6 +7,8 @@ package com.oracle.coherence.grpc.client.common; import com.tangosol.internal.net.ConfigurableCacheFactorySession; + +import com.tangosol.net.CacheService; import com.tangosol.net.Coherence; import com.tangosol.net.NamedCache; @@ -71,6 +73,12 @@ public String getScopeName() { return f_service == null ? Coherence.SYSTEM_SCOPE : f_service.getScopeName(); } + + @Override + public CacheService getCacheService() + { + return getService(); + } // ----- RemoteSessionDispatcher methods -------------------------------- diff --git a/prj/coherence-mp/config/src/main/java/com/oracle/coherence/mp/config/CoherenceConfigSource.java b/prj/coherence-mp/config/src/main/java/com/oracle/coherence/mp/config/CoherenceConfigSource.java index 5be7440b0ee91..deffc42887bb1 100644 --- a/prj/coherence-mp/config/src/main/java/com/oracle/coherence/mp/config/CoherenceConfigSource.java +++ b/prj/coherence-mp/config/src/main/java/com/oracle/coherence/mp/config/CoherenceConfigSource.java @@ -1,17 +1,19 @@ /* - * Copyright (c) 2000, 2022, Oracle and/or its affiliates. + * Copyright (c) 2000, 2025, Oracle and/or its affiliates. * * Licensed under the Universal Permissive License v 1.0 as shown at * https://oss.oracle.com/licenses/upl. */ package com.oracle.coherence.mp.config; -import com.oracle.coherence.common.base.Classes; import com.oracle.coherence.cdi.events.Activated; import com.oracle.coherence.cdi.events.MapName; import com.oracle.coherence.cdi.events.ScopeName; +import com.oracle.coherence.common.base.Classes; + import com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache; + import com.tangosol.net.CacheService; import com.tangosol.net.Coherence; import com.tangosol.net.ConfigurableCacheFactory; @@ -23,7 +25,6 @@ import com.tangosol.net.events.partition.cache.CacheLifecycleEvent; import com.tangosol.net.events.partition.cache.CacheLifecycleEventDispatcher; -import com.tangosol.net.events.partition.cache.PartitionedCacheDispatcher; import com.tangosol.util.MapEvent; import java.util.Collections; @@ -184,8 +185,7 @@ public void onEvent(CacheLifecycleEvent event) if (event.getType() == CacheLifecycleEvent.Type.CREATED) { - m_configMap = ((PartitionedCacheDispatcher) event.getEventDispatcher()).getBackingMapContext() - .getManagerContext().getCacheService().ensureCache(MAP_NAME, Classes.getContextClassLoader()); + m_configMap = event.getEventDispatcher().getCacheService().ensureCache(MAP_NAME, Classes.getContextClassLoader()); } }