Skip to content

Commit 643ca19

Browse files
committed
New SystemProperties logging global changes
- Also deleted unused GFSystem class Signed-off-by: David Matějček <[email protected]>
1 parent 124227e commit 643ca19

File tree

48 files changed

+528
-748
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+528
-748
lines changed

appserver/admin/cli-optional/src/main/java/com/sun/enterprise/admin/cli/optional/DerbyControl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2021, 2025 Contributors to the Eclipse Foundation
33
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
44
*
55
* This program and the accompanying materials are made available under the
@@ -29,6 +29,7 @@
2929

3030
import static com.sun.enterprise.util.Utility.isAllNull;
3131
import static com.sun.enterprise.util.Utility.isEmpty;
32+
import static org.glassfish.main.jdke.props.SystemProperties.setProperty;
3233

3334
/**
3435
* This class uses Java reflection to invoke Derby NetworkServerControl class.
@@ -125,10 +126,10 @@ public DerbyControl(final String derbyCommand, final String derbyHost, final Str
125126

126127
// Do not set derby.system.home if derbyHome is empty
127128
if (!isEmpty(derbyHome)) {
128-
System.setProperty("derby.system.home", derbyHome);
129+
setProperty("derby.system.home", derbyHome, true);
129130
}
130131
// Set the property to not overwrite log file
131-
System.setProperty("derby.infolog.append", "true");
132+
setProperty("derby.infolog.append", "true", true);
132133
}
133134

134135
// constructor

appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import org.xml.sax.SAXException;
7676

7777
import static org.glassfish.appclient.client.acc.AppClientContainer.ClientMainClassSetting.getClientMainClass;
78+
import static org.glassfish.main.jdke.props.SystemProperties.setProperty;
7879

7980
/**
8081
* Embeddable Glassfish app client container (ACC).
@@ -303,7 +304,7 @@ private void completePreparation(final Instrumentation inst) throws Exception, U
303304
prepareURLStreamHandling();
304305

305306
// This is required for us to enable interrupt jaxws service creation calls
306-
System.setProperty("jakarta.xml.ws.spi.Provider", "com.sun.xml.ws.spi.ProviderImpl");
307+
setProperty("jakarta.xml.ws.spi.Provider", "com.sun.xml.ws.spi.ProviderImpl", true);
307308
// InjectionManager's injectClass will be called from getMainMethod
308309

309310
// Load any managed beans

appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainerBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2023, 2025 Contributors to the Eclipse Foundation
33
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
44
*
55
* This program and the accompanying materials are made available under the
@@ -47,6 +47,7 @@
4747
import static org.glassfish.internal.api.ORBLocator.OMG_ORB_INIT_HOST_PROPERTY;
4848
import static org.glassfish.internal.api.ORBLocator.OMG_ORB_INIT_PORT_PROPERTY;
4949
import static org.glassfish.internal.api.ORBLocator.ORB_SSL_CLIENT_REQUIRED;
50+
import static org.glassfish.main.jdke.props.SystemProperties.setProperty;
5051

5152
/**
5253
* Implements a builder for accumulating configuration information for the app client container and then starting the
@@ -239,7 +240,7 @@ private void defineIfNotDefined(final String propName, final String newPropValue
239240
"Value for {0} expected but was not configured or assigned", new Object[] { propName }));
240241

241242
}
242-
System.setProperty(propName, newPropValue);
243+
setProperty(propName, newPropValue, true);
243244
}
244245
}
245246

appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/acc/AppClientContainerSecurityHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import static java.util.Arrays.asList;
4545
import static org.glassfish.appclient.client.acc.Util.writeTextToTempFile;
4646
import static org.glassfish.embeddable.GlassFishVariable.INSTALL_ROOT;
47+
import static org.glassfish.main.jdke.props.SystemProperties.setProperty;
4748

4849
/**
4950
*
@@ -101,7 +102,7 @@ private void initLoginConfig() throws IOException {
101102

102103
// The Java com.sun.security.auth.login.ConfigFile class expects the
103104
// java.security.auth.login.config property value to be a URL
104-
System.setProperty("java.security.auth.login.config", configFile.toURI().toURL().toExternalForm());
105+
setProperty("java.security.auth.login.config", configFile.toURI().toURL().toExternalForm(), true);
105106
}
106107

107108
/**

appserver/appclient/client/acc/src/main/java/org/glassfish/appclient/client/jws/boot/JWSACCMain.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
import org.glassfish.appclient.client.acc.AppClientContainer;
4343
import org.glassfish.appclient.client.acc.JWSACCClassLoader;
4444

45+
import static org.glassfish.main.jdke.props.SystemProperties.setProperty;
46+
4547
/**
4648
* Alternate main class for ACC, used when launched by Java Web Start.
4749
* <p>
@@ -180,7 +182,7 @@ public void run() {
180182
*Set a property that the ACC will retrieve during a JWS launch
181183
*to locate the app client jar file.
182184
*/
183-
System.setProperty("com.sun.aas.downloaded.appclient.jar", downloadedAppclientJarFile.getAbsolutePath());
185+
setProperty("com.sun.aas.downloaded.appclient.jar", downloadedAppclientJarFile.getAbsolutePath(), true);
184186

185187
Thread.currentThread().setContextClassLoader(loader);
186188
System.err.println("XXXX: JWSACCMain.run set CL to thread: " + loader);

appserver/ejb/ejb-container/src/main/java/org/glassfish/ejb/embedded/EJBContainerProviderImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation.
2+
* Copyright (c) 2022, 2025 Contributors to the Eclipse Foundation.
33
* Copyright (c) 2009, 2020 Oracle and/or its affiliates. All rights reserved.
44
*
55
* This program and the accompanying materials are made available under the
@@ -56,6 +56,7 @@
5656
import org.glassfish.hk2.api.ServiceLocator;
5757

5858
import static org.glassfish.embeddable.GlassFishVariable.INSTANCE_ROOT;
59+
import static org.glassfish.main.jdke.props.SystemProperties.setProperty;
5960

6061
/**
6162
* GlassFish implementation of the EJBContainerProvider.
@@ -115,7 +116,7 @@ public EJBContainer createEJBContainer(Map<?, ?> properties) throws EJBException
115116
boolean ok = false;
116117
Locations l = getLocations(properties);
117118
try {
118-
System.setProperty(IS_EJB_CONTAINER, "true");
119+
setProperty(IS_EJB_CONTAINER, "true", true);
119120
createContainer(properties, l);
120121
Set<DeploymentElement> modules = addModules(properties, l);
121122
if (!DeploymentElement.hasEJBModule(modules)) {
@@ -139,7 +140,7 @@ public EJBContainer createEJBContainer(Map<?, ?> properties) throws EJBException
139140
_logger.info("[EJBContainerProviderImpl] Error cleaning up..." + t1);
140141
}
141142
container = null;
142-
System.clearProperty(IS_EJB_CONTAINER);
143+
setProperty(IS_EJB_CONTAINER, null, true);
143144
}
144145
}
145146
}

appserver/extras/embedded/common/bootstrap/src/main/java/org/glassfish/uberjar/bootstrap/UberJarOSGiGlassFishRuntimeBuilder.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation
2+
* Copyright (c) 2022, 2025 Contributors to the Eclipse Foundation
33
* Copyright (c) 2010, 2020 Oracle and/or its affiliates. All rights reserved.
44
*
55
* This program and the accompanying materials are made available under the
@@ -37,6 +37,7 @@
3737
import org.glassfish.embeddable.GlassFishRuntime;
3838
import org.glassfish.embeddable.spi.RuntimeBuilder;
3939
import org.glassfish.main.boot.osgi.OSGiFrameworkLauncher;
40+
import org.glassfish.main.jdke.props.SystemProperties;
4041
import org.osgi.framework.Bundle;
4142
import org.osgi.framework.BundleContext;
4243
import org.osgi.framework.BundleException;
@@ -145,7 +146,8 @@ public GlassFishRuntime build(BootstrapProperties bsOptions, ClassLoader classlo
145146
bsOptions.setProperty(OSGI_PLATFORM.getPropertyName(), OsgiPlatform.Felix.name());
146147
}
147148

148-
System.setProperty(UBER_JAR_URI, jar.toString()); // embedded-osgi-main module will need this to extract the modules.
149+
// embedded-osgi-main module will need this to extract the modules.
150+
SystemProperties.setProperty(UBER_JAR_URI, jar.toString(), true);
149151

150152
String osgiMainModule = "jar:" + jar.toString() + "!/uber-osgi-main.jar";
151153
bsOptions.setProperty("glassfish.auto.start", osgiMainModule);
@@ -160,10 +162,9 @@ public GlassFishRuntime build(BootstrapProperties bsOptions, ClassLoader classlo
160162
}
161163

162164
bsOptions.setProperty(AUTO_START_BUNDLES_PROP, autoStartBundleLocation);
163-
System.setProperty(AUTO_START_BUNDLES_PROP, autoStartBundleLocation);
164-
165-
System.setProperty(INSTALL_ROOT.getSystemPropertyName(), installRoot);
166-
System.setProperty(INSTANCE_ROOT.getSystemPropertyName(), instanceRoot);
165+
SystemProperties.setProperty(AUTO_START_BUNDLES_PROP, autoStartBundleLocation, true);
166+
SystemProperties.setProperty(INSTALL_ROOT.getSystemPropertyName(), installRoot, true);
167+
SystemProperties.setProperty(INSTANCE_ROOT.getSystemPropertyName(), instanceRoot, true);
167168

168169
String version = loadVersion();
169170
bsOptions.setProperty(FRAMEWORK_SYSTEMPACKAGES_EXTRA, "org.glassfish.simpleglassfishapi; version=" + version);

appserver/orb/orb-enabler/src/main/java/org/glassfish/enterprise/api/enabler/ORBConnectorStartup.java

Lines changed: 29 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/*
2+
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
23
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
34
*
45
* This program and the accompanying materials are made available under the
@@ -30,60 +31,47 @@
3031
import org.glassfish.grizzly.config.dom.NetworkListener;
3132
import org.glassfish.hk2.api.PostConstruct;
3233
import org.glassfish.hk2.runlevel.RunLevel;
34+
import org.glassfish.main.jdke.props.SystemProperties;
3335
import org.glassfish.orb.admin.config.IiopListener;
3436
import org.glassfish.orb.admin.config.IiopService;
3537
import org.jvnet.hk2.annotations.Service;
3638

37-
/**
38-
*/
3939
@Service
4040
@RunLevel(StartupRunLevel.VAL)
4141
public class ORBConnectorStartup implements PostConstruct {
4242

4343
// RMI-IIOP delegate constants
44-
private static final String ORB_UTIL_CLASS_PROPERTY =
45-
"javax.rmi.CORBA.UtilClass";
46-
private static final String RMIIIOP_STUB_DELEGATE_CLASS_PROPERTY =
47-
"javax.rmi.CORBA.StubClass";
48-
private static final String RMIIIOP_PRO_DELEGATE_CLASS_PROPERTY =
49-
"javax.rmi.CORBA.PortableRemoteObjectClass";
50-
51-
// ORB constants: OMG standard
52-
private static final String OMG_ORB_CLASS_PROPERTY =
53-
"org.omg.CORBA.ORBClass";
54-
private static final String OMG_ORB_SINGLETON_CLASS_PROPERTY =
55-
"org.omg.CORBA.ORBSingletonClass";
56-
57-
private static final String ORB_CLASS =
58-
"com.sun.corba.ee.impl.orb.ORBImpl";
59-
private static final String ORB_SINGLETON_CLASS =
60-
"com.sun.corba.ee.impl.orb.ORBSingleton";
61-
62-
private static final String ORB_SE_CLASS =
63-
"com.sun.corba.se.impl.orb.ORBImpl";
64-
private static final String ORB_SE_SINGLETON_CLASS =
65-
"com.sun.corba.se.impl.orb.ORBSingleton";
66-
67-
private static final String RMI_UTIL_CLASS =
68-
"com.sun.corba.ee.impl.javax.rmi.CORBA.Util";
69-
private static final String RMI_STUB_CLASS =
70-
"com.sun.corba.ee.impl.javax.rmi.CORBA.StubDelegateImpl";
71-
private static final String RMI_PRO_CLASS =
72-
"com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject";
73-
74-
@Inject @Named(ServerEnvironment.DEFAULT_INSTANCE_NAME)
44+
private static final String ORB_UTIL_CLASS_PROPERTY = "javax.rmi.CORBA.UtilClass";
45+
private static final String RMIIIOP_STUB_DELEGATE_CLASS_PROPERTY = "javax.rmi.CORBA.StubClass";
46+
private static final String RMIIIOP_PRO_DELEGATE_CLASS_PROPERTY = "javax.rmi.CORBA.PortableRemoteObjectClass";
47+
48+
// ORB constants: OMG standard
49+
private static final String OMG_ORB_CLASS_PROPERTY = "org.omg.CORBA.ORBClass";
50+
private static final String OMG_ORB_SINGLETON_CLASS_PROPERTY = "org.omg.CORBA.ORBSingletonClass";
51+
52+
private static final String ORB_CLASS = "com.sun.corba.ee.impl.orb.ORBImpl";
53+
private static final String ORB_SINGLETON_CLASS = "com.sun.corba.ee.impl.orb.ORBSingleton";
54+
55+
private static final String ORB_SE_CLASS = "com.sun.corba.se.impl.orb.ORBImpl";
56+
private static final String ORB_SE_SINGLETON_CLASS = "com.sun.corba.se.impl.orb.ORBSingleton";
57+
58+
private static final String RMI_UTIL_CLASS = "com.sun.corba.ee.impl.javax.rmi.CORBA.Util";
59+
private static final String RMI_STUB_CLASS = "com.sun.corba.ee.impl.javax.rmi.CORBA.StubDelegateImpl";
60+
private static final String RMI_PRO_CLASS = "com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject";
61+
62+
@Inject
63+
@Named(ServerEnvironment.DEFAULT_INSTANCE_NAME)
7564
Config config;
7665

7766
@Inject
7867
private GrizzlyService grizzlyService;
7968

80-
public void postConstruct()
81-
{
69+
public void postConstruct() {
8270
setORBSystemProperties();
8371
initializeLazyListener();
8472
}
8573

86-
/**
74+
/**
8775
* Set ORB-related system properties that are required in case
8876
* user code in the app server or app client container creates a
8977
* new ORB instance. The default result of calling
@@ -92,47 +80,11 @@ public void postConstruct()
9280
* to a different ORB than the RMI-IIOP delegates.
9381
*/
9482
private void setORBSystemProperties() {
95-
96-
java.security.AccessController.doPrivileged(
97-
new java.security.PrivilegedAction() {
98-
public java.lang.Object run() {
99-
if (System.getProperty(OMG_ORB_CLASS_PROPERTY) == null) {
100-
// Assume Sun ee ORB at all times.
101-
// set ORB based on JVM vendor
102-
//
103-
// if (System.getProperty("java.vendor").equals("Sun Microsystems Inc.")) {
104-
// System.setProperty(OMG_ORB_CLASS_PROPERTY, ORB_SE_CLASS);
105-
// } else {
106-
// if not Sun, then set to EE class
107-
System.setProperty(OMG_ORB_CLASS_PROPERTY, ORB_CLASS);
108-
// }
109-
}
110-
111-
if (System.getProperty(OMG_ORB_SINGLETON_CLASS_PROPERTY) == null) {
112-
// Assume Sun ee ORB at all times.
113-
//
114-
// set ORBSingleton based on JVM vendor
115-
// if (System.getProperty("java.vendor").equals("Sun Microsystems Inc.")) {
116-
// System.setProperty(OMG_ORB_SINGLETON_CLASS_PROPERTY, ORB_SE_SINGLETON_CLASS);
117-
// } else {
118-
// if not Sun, then set to EE class
119-
System.setProperty(OMG_ORB_SINGLETON_CLASS_PROPERTY, ORB_SINGLETON_CLASS);
120-
// }
121-
}
122-
123-
System.setProperty(ORB_UTIL_CLASS_PROPERTY,
124-
RMI_UTIL_CLASS);
125-
126-
System.setProperty(RMIIIOP_STUB_DELEGATE_CLASS_PROPERTY,
127-
RMI_STUB_CLASS);
128-
129-
System.setProperty(RMIIIOP_PRO_DELEGATE_CLASS_PROPERTY,
130-
RMI_PRO_CLASS);
131-
132-
return null;
133-
}
134-
}
135-
);
83+
SystemProperties.setProperty(OMG_ORB_CLASS_PROPERTY, ORB_CLASS, false);
84+
SystemProperties.setProperty(OMG_ORB_SINGLETON_CLASS_PROPERTY, ORB_SINGLETON_CLASS, false);
85+
SystemProperties.setProperty(ORB_UTIL_CLASS_PROPERTY, RMI_UTIL_CLASS, true);
86+
SystemProperties.setProperty(RMIIIOP_STUB_DELEGATE_CLASS_PROPERTY, RMI_STUB_CLASS, true);
87+
SystemProperties.setProperty(RMIIIOP_PRO_DELEGATE_CLASS_PROPERTY, RMI_PRO_CLASS, true);
13688
}
13789

13890
/**

0 commit comments

Comments
 (0)