8336316: JFR: Use SettingControl::getValue() instead of setValue() for ActiveSetting event
Reviewed-by: mgronlun
This commit is contained in:
parent
aa15b895c9
commit
b2599f8b0e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2024, 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
|
||||
@ -108,15 +108,18 @@ final class Control {
|
||||
// VM events requires no access control context
|
||||
try {
|
||||
delegate.setValue(value);
|
||||
lastValue = delegate.getValue();
|
||||
} catch (Throwable t) {
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occurred when setting value \"" + value + "\" for " + getClass());
|
||||
lastValue = null;
|
||||
}
|
||||
} else {
|
||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
||||
lastValue = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public Void run() {
|
||||
public String run() {
|
||||
try {
|
||||
delegate.setValue(value);
|
||||
return delegate.getValue();
|
||||
} catch (Throwable t) {
|
||||
// Prevent malicious user to propagate exception callback in the wrong context
|
||||
Logger.log(LogTag.JFR_SETTING, LogLevel.WARN, "Exception occurred when setting value \"" + value + "\" for " + getClass());
|
||||
@ -125,7 +128,6 @@ final class Control {
|
||||
}
|
||||
}, context);
|
||||
}
|
||||
lastValue = value;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user