Skip to content

Commit fa8ff72

Browse files
committed
GEODE-10690: Carry all configured options into the JMX RMI connector server environment
1 parent 06b981b commit fa8ff72

3 files changed

Lines changed: 46 additions & 3 deletions

File tree

‎geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,14 @@ private void configureAndStart() throws IOException {
444444
String[].class.getName(),
445445
String.class.getName()});
446446

447+
// Carry the connector options that are configured as system properties into the
448+
// environment of this manually constructed connector server, so that they take
449+
// effect here as they would for a connector server created by the platform.
450+
String configuredPattern = System.getProperty(RMIConnectorServer.SERIAL_FILTER_PATTERN);
451+
if (configuredPattern != null) {
452+
env.put(RMIConnectorServer.SERIAL_FILTER_PATTERN, configuredPattern);
453+
}
454+
447455
// Manually creates and binds a JMX RMI Connector Server stub with the
448456
// registry created above: the port we pass here is the port that can
449457
// be specified in "service:jmx:rmi://"+hostname+":"+port - where the

‎geode-serialization/src/main/java/org/apache/geode/internal/serialization/filter/OpenMBeanFilterPattern.java‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,22 @@
2222
import javax.management.ObjectName;
2323
import javax.management.openmbean.ArrayType;
2424
import javax.management.openmbean.CompositeData;
25+
import javax.management.openmbean.CompositeDataSupport;
2526
import javax.management.openmbean.CompositeType;
2627
import javax.management.openmbean.OpenType;
2728
import javax.management.openmbean.SimpleType;
2829
import javax.management.openmbean.TabularData;
30+
import javax.management.openmbean.TabularDataSupport;
2931
import javax.management.openmbean.TabularType;
3032

3133
/**
32-
* Defines a serial filter pattern that accepts all open MBean data types and rejects everything
33-
* not included in the pattern.
34+
* Defines a serial filter pattern that accepts all open MBean data types and the container types
35+
* that operation parameters are composed of, and rejects everything not included in the pattern.
3436
*/
3537
public class OpenMBeanFilterPattern implements FilterPattern {
3638

3739
@Override
3840
public String pattern() {
39-
// note: java.util.* may also be needed
4041
return new StringJoiner(";")
4142

4243
// accept all open MBean data types
@@ -54,13 +55,20 @@ public String pattern() {
5455
.add(ObjectName.class.getName())
5556
.add(OpenType.class.getName())
5657
.add(CompositeData.class.getName())
58+
.add(CompositeDataSupport.class.getName())
5759
.add(TabularData.class.getName())
60+
.add(TabularDataSupport.class.getName())
5861
.add(SimpleType.class.getName())
5962
.add(CompositeType.class.getName())
6063
.add(TabularType.class.getName())
6164
.add(ArrayType.class.getName())
6265
.add(MarshalledObject.class.getName())
6366

67+
// accept the container and management types that operation parameters and queries use
68+
.add(Object.class.getName())
69+
.add("java.util.*")
70+
.add("javax.management.*")
71+
6472
// reject all others
6573
.add("!*")
6674
.toString();

‎geode-serialization/src/test/java/org/apache/geode/internal/serialization/filter/OpenMBeanFilterPatternTest.java‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
import javax.management.ObjectName;
2424
import javax.management.openmbean.ArrayType;
2525
import javax.management.openmbean.CompositeData;
26+
import javax.management.openmbean.CompositeDataSupport;
2627
import javax.management.openmbean.CompositeType;
2728
import javax.management.openmbean.SimpleType;
2829
import javax.management.openmbean.TabularData;
30+
import javax.management.openmbean.TabularDataSupport;
2931
import javax.management.openmbean.TabularType;
3032

3133
import org.junit.Before;
@@ -135,6 +137,31 @@ public void includesMarshalledObject() {
135137
assertThat(defaultPattern).contains(MarshalledObject.class.getName());
136138
}
137139

140+
@Test
141+
public void includesCompositeDataSupport() {
142+
assertThat(defaultPattern).contains(CompositeDataSupport.class.getName());
143+
}
144+
145+
@Test
146+
public void includesTabularDataSupport() {
147+
assertThat(defaultPattern).contains(TabularDataSupport.class.getName());
148+
}
149+
150+
@Test
151+
public void includesObject() {
152+
assertThat(defaultPattern).contains(Object.class.getName());
153+
}
154+
155+
@Test
156+
public void includesUtilTypes() {
157+
assertThat(defaultPattern).contains("java.util.*");
158+
}
159+
160+
@Test
161+
public void includesManagementTypes() {
162+
assertThat(defaultPattern).contains("javax.management.*");
163+
}
164+
138165
@Test
139166
public void rejectsAllOtherTypes() {
140167
assertThat(defaultPattern).endsWith(";!*");

0 commit comments

Comments
 (0)