diff --git a/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/event/EventTypes.java b/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/event/EventTypes.java index 2bb65584df1..80570188389 100644 --- a/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/event/EventTypes.java +++ b/nucleus/common/glassfish-api/src/main/java/org/glassfish/api/event/EventTypes.java @@ -37,6 +37,7 @@ * only if the new code is made subject to such option by the copyright * holder. */ +// Portions Copyright 2022 Payara Foundation and/or its affiliates. package org.glassfish.api.event; @@ -57,11 +58,13 @@ public final class EventTypes { private static final Map> EVENTS = new ConcurrentHashMap<>(); // stock events. + public static final String POST_SERVER_INIT_NAME = "post_server_init"; public static final String SERVER_STARTUP_NAME = "server_startup"; public static final String SERVER_READY_NAME = "server_ready"; public static final String PREPARE_SHUTDOWN_NAME = "prepare_shutdown"; public static final String SERVER_SHUTDOWN_NAME = "server_shutdown"; + public static final EventTypes POST_SERVER_INIT = create(POST_SERVER_INIT_NAME); public static final EventTypes SERVER_STARTUP = create(SERVER_STARTUP_NAME); public static final EventTypes SERVER_READY = create(SERVER_READY_NAME); public static final EventTypes SERVER_SHUTDOWN = create(SERVER_SHUTDOWN_NAME); diff --git a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java index 501ba71581e..a582fcde5f5 100644 --- a/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java +++ b/nucleus/core/kernel/src/main/java/com/sun/enterprise/v3/server/AppServerStartup.java @@ -350,6 +350,7 @@ public boolean run() { logger.log(level, "Init level done in " + (initFinishTime - context.getCreationTime()) + " ms"); } + events.send(new Event(EventTypes.POST_SERVER_INIT), false); appInstanceListener.startRecordingFutures(); if (!proceedTo(StartupRunLevel.VAL)) { diff --git a/nucleus/payara-modules/payara-executor-service/src/main/java/fish/payara/nucleus/executorservice/PayaraExecutorService.java b/nucleus/payara-modules/payara-executor-service/src/main/java/fish/payara/nucleus/executorservice/PayaraExecutorService.java index 263a97aaf36..38bccd43076 100644 --- a/nucleus/payara-modules/payara-executor-service/src/main/java/fish/payara/nucleus/executorservice/PayaraExecutorService.java +++ b/nucleus/payara-modules/payara-executor-service/src/main/java/fish/payara/nucleus/executorservice/PayaraExecutorService.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) [2017-2021] Payara Foundation and/or its affiliates. All rights reserved. + * Copyright (c) [2017-2022] Payara Foundation and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -69,7 +69,6 @@ import org.glassfish.api.event.EventTypes; import org.glassfish.api.event.Events; import org.glassfish.internal.api.Globals; -import org.glassfish.internal.deployment.Deployment; import org.jvnet.hk2.annotations.Optional; import org.jvnet.hk2.annotations.Service; import org.jvnet.hk2.config.ConfigBeanProxy; @@ -81,6 +80,8 @@ import com.sun.enterprise.config.serverbeans.Config; /** + * Service that provides a shared executor service for server internals rather than all services creating and using + * their own. * * @author Andrew Pielage */ @@ -130,7 +131,7 @@ public void postConstruct() { */ @Override public void event(Event event) { - if (event.is(Deployment.ALL_APPLICATIONS_LOADED)) { + if (event.is(EventTypes.POST_SERVER_INIT)) { // Embedded containers can be started and stopped multiple times. // Thus we need to initialize anytime the server instance is started. if (null == threadPoolExecutor) {