Skip to content

Commit e9ea743

Browse files
committed
Enhancement Request 36471876 - [36358538->24.09] ENH: Improve the Management invocation service override support with management-config.xml (merge main -> ce/24.09 @ 108139)
[git-p4: depot-paths = "//dev/coherence-ce/main/": change = 108194]
1 parent d13ffc8 commit e9ea743

File tree

5 files changed

+81
-6
lines changed

5 files changed

+81
-6
lines changed

prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/net/management/Connector.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*
3-
* Copyright (c) 2000, 2023, Oracle and/or its affiliates.
3+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
44
*
55
* Licensed under the Universal Permissive License v 1.0 as shown at
66
* https://oss.oracle.com/licenses/upl.
@@ -2530,14 +2530,15 @@ public void startService(com.tangosol.coherence.component.util.SafeCluster clust
25302530
service.setUserContext(this);
25312531

25322532
// This is to use the Default Serializer when POF is enabled.
2533-
URL url = Resources.findResource("management-config.xml", null);
2533+
URL url = Resources.findFileOrResourceOrDefault("management-config.xml", null);
25342534
if (url != null)
25352535
{
25362536
try
25372537
{
25382538
XmlDocument xml = XmlHelper.loadXml(url.openStream());
25392539
if (xml != null)
25402540
{
2541+
_trace("Loaded management configuration from \"" + url + '"', 3);
25412542
service.configure(xml);
25422543
}
25432544
}

prj/coherence-core/src/main/resources/management-config.xml renamed to prj/coherence-core/src/main/resources/com/oracle/coherence/defaults/management-config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0"?>
22
<!--
3-
Copyright (c) 2000, 2020, Oracle and/or its affiliates.
3+
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
44
55
Licensed under the Universal Permissive License v 1.0 as shown at
6-
http://oss.oracle.com/licenses/upl.
6+
https://oss.oracle.com/licenses/upl.
77
-->
88
<!--
99
Service configuration descriptor for the Management invocation service used by the
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
3+
*
4+
* Licensed under the Universal Permissive License v 1.0 as shown at
5+
* https://oss.oracle.com/licenses/upl.
6+
*/
7+
package config;
8+
9+
import com.tangosol.net.CacheFactory;
10+
import com.tangosol.net.Cluster;
11+
import com.tangosol.net.management.MBeanServerProxy;
12+
import com.tangosol.net.management.Registry;
13+
14+
import org.junit.BeforeClass;
15+
import org.junit.Test;
16+
17+
import static org.junit.Assert.assertEquals;
18+
import static org.junit.Assert.assertNotNull;
19+
20+
/**
21+
* Test management-config.xml override.
22+
*/
23+
public class ManagementConfigOverrideTests
24+
{
25+
@BeforeClass
26+
public static void setup()
27+
{
28+
System.setProperty("coherence.management", "all");
29+
System.setProperty("coherence.management.report.autostart", "true");
30+
System.setProperty("coherence.management.exclude", ".*type=Platform,Domain=java.lang,subType=ClassLoading,.* .*type=Platform,Domain=java.lang,subType=Compilation,.* .*type=Platform,Domain=java.lang,subType=MemoryManager,.* .*type=Platform,Domain=java.lang,subType=Threading,.* .*type=DiagnosticCommand,Domain=com.sun.management,subType=HotSpotDiagnostic,.* .*type=Cache,.*,name=$meta$.* .*type=StorageManager,.*,cache=$meta$.*");
31+
System.setProperty("java.net.preferIPv4Stack", "true");
32+
System.setProperty("coherence.wka", "127.0.0.1");
33+
}
34+
35+
@Test
36+
public void shouldOverrideManagementConfig()
37+
{
38+
Cluster cluster = CacheFactory.ensureCluster();
39+
Registry registry = cluster.getManagement();
40+
assertNotNull("JMX is disabled", registry);
41+
MBeanServerProxy proxy = registry.getMBeanServerProxy();
42+
Long requestTimeout = (Long) proxy.getAttribute("Coherence:type=Service,name=Management,nodeId=1", "RequestTimeoutMillis");
43+
assertNotNull("request timeout is null", requestTimeout);
44+
assertEquals(123456, requestTimeout.longValue());
45+
}
46+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
Copyright (c) 2024, Oracle and/or its affiliates.
4+
5+
Licensed under the Universal Permissive License v 1.0 as shown at
6+
https://oss.oracle.com/licenses/upl.
7+
-->
8+
<!--
9+
Service configuration descriptor for the Management invocation service used by the
10+
Coherence JMX framework.
11+
-->
12+
<config>
13+
<!--
14+
Use standard Java serialization regardless of the global settings specified
15+
in the ExternalizableHelper.xml descriptor.
16+
-->
17+
<scheme-name>JMXManagementScheme</scheme-name>
18+
<service-name>JMXManagementService</service-name>
19+
<serializer>
20+
<class-name>com.tangosol.io.DefaultSerializer</class-name>
21+
</serializer>
22+
<thread-count-max>2</thread-count-max>
23+
<thread-count-min>2</thread-count-min>
24+
<task-timeout>30m</task-timeout>
25+
<request-timeout>123456</request-timeout>
26+
<guardian-timeout>300000</guardian-timeout>
27+
<service-failure-policy>exit-process</service-failure-policy>
28+
<autostart>true</autostart>
29+
</config>

prj/test/functional/xsd/src/main/java/xsd/XsdValidationTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.junit.runners.Parameterized;
3030

3131
import javax.xml.XMLConstants;
32-
3332
import javax.xml.parsers.SAXParserFactory;
3433
import javax.xml.validation.SchemaFactory;
3534

@@ -101,7 +100,7 @@ public void testDefaultFiles()
101100
XmlValidator.validate("../../../coherence-core/src/main/resources/com/oracle/coherence/defaults/coherence-cache-config.xml");
102101
XmlValidator.validate("../../../coherence-core/src/main/resources/com/oracle/coherence/defaults/grpc-proxy-cache-config.xml");
103102
XmlValidator.validate("../../../coherence-core/src/main/resources/coherence-pof-config.xml");
104-
XmlValidator.validate("../../../coherence-core/src/main/resources/management-config.xml");
103+
XmlValidator.validate("../../../coherence-core/src/main/resources/com/oracle/coherence/defaults/management-config.xml");
105104
XmlValidator.validate("../../../coherence-core/src/main/resources/com/oracle/coherence/defaults/tangosol-coherence-override-dev.xml");
106105
XmlValidator.validate("../../../coherence-core/src/main/resources/com/oracle/coherence/defaults/tangosol-coherence-override-eval.xml");
107106
XmlValidator.validate("../../../coherence-core/src/main/resources/com/oracle/coherence/defaults/tangosol-coherence-override-prod.xml");

0 commit comments

Comments
 (0)