mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-14 18:03:44 +00:00
8345049: Remove the jmx.tabular.data.hash.map compatibility property
Reviewed-by: cjplummer, sspitsyn, dfuchs
This commit is contained in:
parent
8b46db0c0d
commit
c00557f8f5
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -143,16 +143,9 @@ public class TabularDataSupport
|
||||
List<String> tmpNames = tabularType.getIndexNames();
|
||||
this.indexNamesArray = tmpNames.toArray(new String[tmpNames.size()]);
|
||||
|
||||
// Since LinkedHashMap was introduced in SE 1.4, it's conceivable even
|
||||
// if very unlikely that we might be the server of a 1.3 client. In
|
||||
// that case you'll need to set this property. See CR 6334663.
|
||||
boolean useHashMap = Boolean.getBoolean("jmx.tabular.data.hash.map");
|
||||
|
||||
// Construct the empty contents HashMap
|
||||
//
|
||||
this.dataMap = useHashMap ?
|
||||
new HashMap<>(initialCapacity, loadFactor) :
|
||||
new LinkedHashMap<>(initialCapacity, loadFactor);
|
||||
this.dataMap = new LinkedHashMap<>(initialCapacity, loadFactor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -57,8 +57,6 @@ import javax.management.openmbean.TabularType;
|
||||
public class TabularDataOrderTest {
|
||||
private static String failure;
|
||||
|
||||
private static final String COMPAT_PROP_NAME = "jmx.tabular.data.hash.map";
|
||||
|
||||
private static final String[] intNames = {
|
||||
"unus", "duo", "tres", "quatuor", "quinque", "sex", "septem",
|
||||
"octo", "novem", "decim",
|
||||
@ -129,44 +127,6 @@ public class TabularDataOrderTest {
|
||||
if (!ordered)
|
||||
fail("Order not preserved");
|
||||
|
||||
// Now test the undocumented property that causes HashMap to be used
|
||||
// instead of LinkedHashMap, in case serializing to a 1.3 client.
|
||||
// We serialize and deserialize in case the implementation handles
|
||||
// this at serialization time. Then we look at object fields; that's
|
||||
// not guaranteed to work but at worst it will fail spuriously and
|
||||
// we'll have to update the test.
|
||||
System.out.println("Testing compatible behaviour");
|
||||
System.setProperty(COMPAT_PROP_NAME, "true");
|
||||
td = makeTable();
|
||||
System.out.println(td);
|
||||
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oout = new ObjectOutputStream(bout);
|
||||
oout.writeObject(td);
|
||||
oout.close();
|
||||
byte[] bytes = bout.toByteArray();
|
||||
ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
|
||||
ObjectInputStream oin = new ObjectInputStream(bin);
|
||||
td = (TabularData) oin.readObject();
|
||||
boolean found = false;
|
||||
for (Field f : td.getClass().getDeclaredFields()) {
|
||||
if (Modifier.isStatic(f.getModifiers()))
|
||||
continue;
|
||||
f.setAccessible(true);
|
||||
Object x = f.get(td);
|
||||
if (x != null && x.getClass() == HashMap.class) {
|
||||
found = true;
|
||||
System.out.println(
|
||||
x.getClass().getName() + " TabularDataSupport." +
|
||||
f.getName() + " = " + x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
fail("TabularDataSupport does not contain HashMap though " +
|
||||
COMPAT_PROP_NAME + "=true");
|
||||
}
|
||||
System.clearProperty(COMPAT_PROP_NAME);
|
||||
|
||||
System.out.println("Testing MXBean behaviour");
|
||||
MBeanServer mbs = MBeanServerFactory.newMBeanServer();
|
||||
ObjectName name = new ObjectName("a:b=c");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user