diff --git a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ServerLifecycleModule.java b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ServerLifecycleModule.java index 1e3682501cc..497a64a59aa 100755 --- a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ServerLifecycleModule.java +++ b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/ServerLifecycleModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Contributors to the Eclipse Foundation + * Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -36,6 +36,7 @@ import com.sun.appserv.server.LifecycleListener; import com.sun.appserv.server.ServerLifecycleException; import com.sun.enterprise.util.LocalStringManagerImpl; +import org.glassfish.api.logging.LogHelper; /** * @author Sridatta Viswanath @@ -112,7 +113,7 @@ LifecycleListener loadServerLifecycle() throws ServerLifecycleException { classLoader = ctx.getLifecycleParentClassLoader(); } else { URL[] urls = getURLs(); - _logger.log(Level.FINE, "Lifecycle module = {0} has classpath URLs = {1}", new Object[] {getName(), urls}); + _logger.log(Level.FINE, "Lifecycle module = {0} has classpath URLs = {1}", new Object[] { getName(), urls }); this.urlClassLoader = new GlassfishUrlClassLoader(urls, ctx.getLifecycleParentClassLoader()); classLoader = this.urlClassLoader; } @@ -120,10 +121,10 @@ LifecycleListener loadServerLifecycle() throws ServerLifecycleException { Class clazz = (Class) Class.forName(className, true, classLoader); slcl = clazz.getDeclaredConstructor().newInstance(); } catch (Exception ee) { - _logger.log(Level.SEVERE, KernelLoggerInfo.exceptionLoadingLifecycleModule, new Object[] {this.name, ee}); + LogHelper.log(_logger, Level.SEVERE, KernelLoggerInfo.exceptionLoadingLifecycleModule, ee, new Object[] { this.name, ee }); if (isFatal) { throw new ServerLifecycleException(localStrings.getLocalString("lifecyclemodule.loadExceptionIsFatal", - "Treating failure loading the lifecycle module as fatal", this.name)); + "Treating failure loading the lifecycle module as fatal", this.name)); } } @@ -132,16 +133,15 @@ LifecycleListener loadServerLifecycle() throws ServerLifecycleException { private URL[] getURLs() { List urlList = ASClassLoaderUtil.getURLsFromClasspath( - this.classpath, File.pathSeparator, ""); + this.classpath, File.pathSeparator, ""); return ASClassLoaderUtil.convertURLListToArray(urlList); } - private void postEvent(int eventType, Object data) throws ServerLifecycleException { if (slcl == null) { if (isFatal) { throw new ServerLifecycleException(localStrings.getLocalString("lifecyclemodule.loadExceptionIsFatal", - "Treating failure loading the lifecycle module as fatal", this.name)); + "Treating failure loading the lifecycle module as fatal", this.name)); } return; } @@ -150,48 +150,43 @@ private void postEvent(int eventType, Object data) throws ServerLifecycleExcepti setClassLoader(); } - LifecycleEvent slcEvent= new LifecycleEvent(this, eventType, data, this.leContext); + LifecycleEvent slcEvent = new LifecycleEvent(this, eventType, data, this.leContext); try { slcl.handleEvent(slcEvent); } catch (ServerLifecycleException sle) { - _logger.log(Level.WARNING, KernelLoggerInfo.serverLifecycleException, new Object[] {this.name, sle}); + LogHelper.log(_logger, Level.WARNING, KernelLoggerInfo.serverLifecycleException, sle, new Object[] { this.name, sle }); if (isFatal) { throw sle; } } catch (Exception ee) { - _logger.log(Level.WARNING, KernelLoggerInfo.lifecycleModuleException, new Object[] {this.name, ee}); + LogHelper.log(_logger, Level.WARNING, KernelLoggerInfo.lifecycleModuleException, ee, new Object[] { this.name, ee }); if (isFatal) { - throw new ServerLifecycleException(localStrings.getLocalString("lifecyclemodule.event_exceptionIsFatal", "Treating the exception from lifecycle module event handler as fatal"), ee); + throw new ServerLifecycleException(localStrings.getLocalString("lifecyclemodule.event_exceptionIsFatal", + "Treating the exception from lifecycle module event handler as fatal"), ee); } } } - public void onInitialization() throws ServerLifecycleException { postEvent(LifecycleEvent.INIT_EVENT, props); } - public void onStartup() throws ServerLifecycleException { postEvent(LifecycleEvent.STARTUP_EVENT, props); } - public void onReady() throws ServerLifecycleException { postEvent(LifecycleEvent.READY_EVENT, props); } - public void onShutdown() throws ServerLifecycleException { postEvent(LifecycleEvent.SHUTDOWN_EVENT, props); } - public void onTermination() throws ServerLifecycleException { postEvent(LifecycleEvent.TERMINATION_EVENT, props); } - private void setClassLoader() { // set the url class loader as the thread context class loader PrivilegedAction action = () -> {