mirror of https://github.com/apache/activemq.git
[AMQ-9563] Remove usage of java.security.AccessController where possible. Document JDK 21 refactor TODO
This commit is contained in:
parent
5debe1facc
commit
7c81d73d8a
|
@ -205,6 +205,7 @@ public class AnnotatedMBean extends StandardMBean {
|
|||
objects = (objects == null) ? new Object[]{} : objects;
|
||||
JMXAuditLogEntry entry = null;
|
||||
if (audit != OFF) {
|
||||
// [AMQ-9563] TODO: JDK 21 use Subject.current() instead
|
||||
Subject subject = Subject.getSubject(AccessController.getContext());
|
||||
String caller = "anonymous";
|
||||
if (subject != null) {
|
||||
|
|
|
@ -19,8 +19,6 @@ package org.apache.activemq;
|
|||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.RejectedExecutionHandler;
|
||||
|
||||
|
@ -67,22 +65,11 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
|
|||
String host = null;
|
||||
String port = null;
|
||||
try {
|
||||
host = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
String result = System.getProperty("org.apache.activemq.AMQ_HOST");
|
||||
result = (result==null||result.isEmpty()) ? System.getProperty("AMQ_HOST","localhost") : result;
|
||||
return result;
|
||||
}
|
||||
});
|
||||
port = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
String result = System.getProperty("org.apache.activemq.AMQ_PORT");
|
||||
result = (result==null||result.isEmpty()) ? System.getProperty("AMQ_PORT","61616") : result;
|
||||
return result;
|
||||
}
|
||||
});
|
||||
host = System.getProperty("org.apache.activemq.AMQ_HOST");
|
||||
host = (host==null||host.isBlank()) ? System.getProperty("AMQ_HOST","localhost") : host;
|
||||
|
||||
port = System.getProperty("org.apache.activemq.AMQ_PORT");
|
||||
port = (port==null||port.isBlank()) ? System.getProperty("AMQ_PORT","61616") : port;
|
||||
} catch(Throwable e){
|
||||
LOG.debug("Failed to look up System properties for host and port",e);
|
||||
}
|
||||
|
@ -92,7 +79,6 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
|
|||
DEFAULT_BROKER_PORT = Integer.parseInt(port);
|
||||
}
|
||||
|
||||
|
||||
public static final String DEFAULT_BROKER_BIND_URL;
|
||||
|
||||
static{
|
||||
|
@ -100,14 +86,8 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
|
|||
String bindURL = null;
|
||||
|
||||
try {
|
||||
bindURL = AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
@Override
|
||||
public String run() {
|
||||
String result = System.getProperty("org.apache.activemq.BROKER_BIND_URL");
|
||||
result = (result==null||result.isEmpty()) ? System.getProperty("BROKER_BIND_URL",defaultURL) : result;
|
||||
return result;
|
||||
}
|
||||
});
|
||||
bindURL = System.getProperty("org.apache.activemq.BROKER_BIND_URL");
|
||||
bindURL = (bindURL==null||bindURL.isEmpty()) ? System.getProperty("BROKER_BIND_URL",defaultURL) : bindURL;
|
||||
} catch(Throwable e){
|
||||
LOG.debug("Failed to look up System properties for host and port",e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue