Skip to content

Commit

Permalink
8345045: Remove the jmx.remote.x.buffer.size JMX notification property
Browse files Browse the repository at this point in the history
Reviewed-by: amenkov, sspitsyn
  • Loading branch information
kevinjwalls committed Jan 23, 2025
1 parent 119899b commit 8b46db0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
Expand Down Expand Up @@ -262,21 +262,11 @@ public static Throwable getCause(Throwable t) {
public static int getNotifBufferSize(Map<String, ?> env) {
int defaultQueueSize = 1000; // default value

// keep it for the compatibility for the fix:
// 6174229: Environment parameter should be notification.buffer.size
// instead of buffer.size
final String oldP = "jmx.remote.x.buffer.size";

// the default value re-specified in the system
try {
String s = System.getProperty(BUFFER_SIZE_PROPERTY);
if (s != null) {
defaultQueueSize = Integer.parseInt(s);
} else { // try the old one
s = System.getProperty(oldP);
if (s != null) {
defaultQueueSize = Integer.parseInt(s);
}
}
} catch (RuntimeException e) {
logger.warning("getNotifBufferSize",
Expand All @@ -292,10 +282,6 @@ public static int getNotifBufferSize(Map<String, ?> env) {
queueSize = (int)EnvHelp.getIntegerAttribute(env,BUFFER_SIZE_PROPERTY,
defaultQueueSize,0,
Integer.MAX_VALUE);
} else { // try the old one
queueSize = (int)EnvHelp.getIntegerAttribute(env,oldP,
defaultQueueSize,0,
Integer.MAX_VALUE);
}
} catch (RuntimeException e) {
logger.warning("getNotifBufferSize",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 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
Expand All @@ -23,7 +23,7 @@

/*
* @test NotifBufferSizePropertyNameTest
* @bug 6174229
* @bug 6174229 8345045
* @summary Verify the property name specifying server notification buffer size.
* @author Shanliang JIANG
*
Expand Down Expand Up @@ -52,35 +52,25 @@ public void handleNotification(Notification n, Object hb) {
};

public static void main(String[] args) throws Exception {
System.out.println(
"Verify the property name specifying the server notification buffer size.");
System.out.println("Verify the property name specifying the server notification buffer size.");

oname = new ObjectName ("Default:name=NotificationEmitter");
url = new JMXServiceURL("rmi", null, 0);
Map env = new HashMap(2);

System.out.println("Test the new property name.");
System.out.println("Test the property name.");
env.put("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize));
test(env);

System.out.println("Test the old property name.");
env.remove("jmx.remote.x.notification.buffer.size");
env.put("jmx.remote.x.buffer.size", String.valueOf(bufferSize));
test(env);

// Recognition of the old, incorrect property "jmx.remote.x.buffer.size" has been dropped.
// Do not test old name is recognised, but do test it does not interfere with correct name:
System.out.println("Test that the new property name overwrite the old one.");
env.put("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize));
env.put("jmx.remote.x.buffer.size", String.valueOf(bufferSize*6));
test(env);

System.out.println("Test the old property name on system.");
System.setProperty("jmx.remote.x.buffer.size", String.valueOf(bufferSize));
test(null);

System.out.println(
"Test that the new property name overwrite the old one on system.");
System.setProperty("jmx.remote.x.notification.buffer.size",
String.valueOf(bufferSize));
System.out.println("Test that the new property name overwrite the old one on system.");
System.setProperty("jmx.remote.x.notification.buffer.size", String.valueOf(bufferSize));
System.setProperty("jmx.remote.x.buffer.size", String.valueOf(bufferSize*6));
test(null);
}
Expand Down

0 comments on commit 8b46db0

Please sign in to comment.