Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FISH-8302 Virtual Threads Configuration #7198

Merged
merged 11 commits into from
Feb 21, 2025
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2022-2025 Payara Foundation and/or its affiliates -->

<!-- concurrent/managedExecutorService.inc -->

Expand Down Expand Up @@ -85,6 +86,10 @@
<sun:checkbox label="$resource{i18n.common.Enabled}" selected="#{pageSession.valueMap['longRunningTasks']}" selectedValue="true" />
</sun:property>

<sun:property id="usevirtualthreads" rendered="#{pageSession.showVirtualThreads}" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18ncon.usevirtualthreads}">
<sun:checkbox label="$resource{i18n.common.Enabled}" selected="#{pageSession.valueMap['useVirtualThreads']}" selectedValue="true" />
</sun:property>

<sun:property id="useforkjoinpool" rendered="#{pageSession.showForkJoin}" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18ncon.useforkjoinpool}">
<sun:checkbox label="$resource{i18n.common.Enabled}" selected="#{pageSession.valueMap['useForkJoinPool']}" selectedValue="true" />
</sun:property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2022-2025 Payara Foundation and/or its affiliates -->

<!-- concurrent/managedExecutorServiceEdit.jsf -->
<!initPage
Expand All @@ -63,7 +64,7 @@

gf.buildResourceUrl(base="#{pageSession.parentUrl}/#{pageSession.childType}", resourceName="#{pageSession.Name}", url="#{pageSession.selfUrl}");
gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}", valueMap="#{pageSession.valueMap}");
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "longRunningTasks", "useForkJoinPool" });
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "longRunningTasks", "useVirtualThreads", "useForkJoinPool" });
setPageSessionAttribute(key="skipAttrsList", value={"jndiName"});

gf.restRequest(endpoint="#{pageSession.selfUrl}/property" method="GET" result="#{requestScope.propTable}");
Expand All @@ -73,6 +74,7 @@
setPageSessionAttribute(key="convertToFalseList2" value={"enabled"});
setPageSessionAttribute(key="showMaxPoolSize" value="#{true}");
setPageSessionAttribute(key="showForkJoin" value="#{true}");
setPageSessionAttribute(key="showVirtualThreads" value="#{true}");
setPageSessionAttribute(key="showTaskQueue" value="#{true}");
setPageSessionAttribute(key="listCommand" value="list-managed-executor-services");
setPageSessionAttribute(key="logicalJndiMapKey" value="managedExecutorServices");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2022-2025 Payara Foundation and/or its affiliates -->

<!-- concurent/managedExecutorServiceNew.jsf -->

Expand All @@ -55,7 +56,7 @@
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/concurrent/managedExecutorServices.jsf");
setPageSessionAttribute(key="childType" value="managed-executor-service");
setPageSessionAttribute(key="isConcurrent" value="true");
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "longRunningTasks", "useForkJoinPool" });
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "longRunningTasks", "useVirtualThreads", "useForkJoinPool" });
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/resources");
gf.getDefaultValues(endpoint="#{pageSession.parentUrl}/#{pageSession.childType}", valueMap="#{pageSession.valueMap}");
setPageSessionAttribute(key="edit" value="#{false}" );
Expand All @@ -64,6 +65,7 @@
mapPut(map="#{pageSession.valueMap2}" key="enabled" value="true");
setPageSessionAttribute(key="showMaxPoolSize" value="#{true}");
setPageSessionAttribute(key="showTaskQueue" value="#{true}");
setPageSessionAttribute(key="showVirtualThreads" value="#{true}");
setPageSessionAttribute(key="showForkJoin" value="#{true}");
/>
</event>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2025 Payara Foundation and/or its affiliates -->

<!-- concurrent/managedScheduledExecutorServiceEdit.jsf -->
<!initPage
Expand All @@ -63,7 +64,7 @@

gf.buildResourceUrl(base="#{pageSession.parentUrl}/#{pageSession.childType}", resourceName="#{pageSession.Name}", url="#{pageSession.selfUrl}");
gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}", valueMap="#{pageSession.valueMap}");
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "longRunningTasks" });
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "longRunningTasks", "useVirtualThreads" });
setPageSessionAttribute(key="skipAttrsList", value={"jndiName"});

gf.restRequest(endpoint="#{pageSession.selfUrl}/property" method="GET" result="#{requestScope.propTable}");
Expand All @@ -74,6 +75,7 @@
setPageSessionAttribute(key="showMaxPoolSize" value="#{false}");
setPageSessionAttribute(key="showTaskQueue" value="#{false}");
setPageSessionAttribute(key="showForkJoin" value="#{false}");
setPageSessionAttribute(key="showVirtualThreads" value="#{true}");
setPageSessionAttribute(key="listCommand" value="list-managed-scheduled-executor-services");
setPageSessionAttribute(key="logicalJndiMapKey" value="managedScheduledExecutorServices");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2025 Payara Foundation and/or its affiliates -->

<!-- concurent/managedScheduledExecutorServiceNew.jsf -->

Expand All @@ -55,7 +56,7 @@
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/concurrent/managedScheduledExecutorServices.jsf");
setPageSessionAttribute(key="childType" value="managed-scheduled-executor-service");
setPageSessionAttribute(key="isConcurrent" value="true");
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "longRunningTasks" });
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "longRunningTasks", "useVirtualThreads" });
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/resources");
gf.getDefaultValues(endpoint="#{pageSession.parentUrl}/#{pageSession.childType}", valueMap="#{pageSession.valueMap}");
setPageSessionAttribute(key="edit" value="#{false}" );
Expand All @@ -66,6 +67,7 @@
setPageSessionAttribute(key="showMaxPoolSize" value="#{false}");
setPageSessionAttribute(key="showTaskQueue" value="#{false}");
setPageSessionAttribute(key="showForkJoin" value="#{false}");
setPageSessionAttribute(key="showVirtualThreads" value="#{true}");
/>
</event>
" <script type="text/javascript">admingui.nav.selectTreeNodeById(admingui.nav.TREE_ID+":resources:concurrent:managedScheduledExecutorServices");</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2025 Payara Foundation and/or its affiliates -->

<!-- concurrent/managedThreadFactoryAttr.inc -->

Expand Down Expand Up @@ -83,6 +84,10 @@
<sun:textField id="threadPriorityProp" styleClass="integer" columns="$int{55}" maxLength="#{sessionScope.fieldLengths['maxLength.common.description']}" text="#{pageSession.valueMap['threadPriority']}" />
</sun:property>

<sun:property id="usevirtualthreads" rendered="#{pageSession.showVirtualThreads}" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18ncon.usevirtualthreads}">
<sun:checkbox label="$resource{i18n.common.Enabled}" selected="#{pageSession.valueMap['useVirtualThreads']}" selectedValue="true" />
</sun:property>

<sun:property id="deploymentOrder" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" rendered="#{edit}" label="$resource{i18n.common.resource.deploymentOrder}" helpText="$resource{i18n.common.resource.deploymentOrderHelp}" >
<sun:textField id="deploymentOrder" styleClass="integer" columns="$int{10}" maxLength="#{sessionScope.fieldLengths['maxLength.common.deploymentOrder']}" text="#{pageSession.valueMap['deploymentOrder']}" />
</sun:property>
Expand All @@ -92,4 +97,4 @@
</sun:property>
"<br /><br />
</sun:propertySheetSection>
</sun:propertySheet>
</sun:propertySheet>
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2025 Payara Foundation and/or its affiliates -->

<!-- concurrent/managedThreadFactoryEdit.jsf -->
<!initPage
Expand All @@ -63,12 +64,13 @@

gf.buildResourceUrl(base="#{pageSession.parentUrl}/#{pageSession.childType}", resourceName="#{pageSession.Name}", url="#{pageSession.selfUrl}");
gf.getEntityAttrs(endpoint="#{pageSession.selfUrl}", valueMap="#{pageSession.valueMap}");
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled"});
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "useVirtualThreads"});
setPageSessionAttribute(key="skipAttrsList", value={"jndiName"});

gf.restRequest(endpoint="#{pageSession.selfUrl}/property" method="GET" result="#{requestScope.propTable}");
setPageSessionAttribute(key="tableList" value="#{requestScope.propTable.data.extraProperties.properties}");
setPageSessionAttribute(key="edit" value="#{true}" );
setPageSessionAttribute(key="showVirtualThreads" value="#{true}");

setPageSessionAttribute(key="convertToFalseList2" value={"enabled"});
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
holder.

-->
<!-- Portions Copyright 2025 Payara Foundation and/or its affiliates -->

<!-- concurent/managedThreadFactoryNew.jsf -->

Expand All @@ -55,10 +56,11 @@
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/concurrent/managedThreadFactories.jsf");
setPageSessionAttribute(key="childType" value="managed-thread-factory");
setPageSessionAttribute(key="isConcurrent" value="true");
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled"});
setPageSessionAttribute(key="convertToFalseList" value={"enabled", "contextInfoEnabled", "useVirtualThreads"});
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/resources");
gf.getDefaultValues(endpoint="#{pageSession.parentUrl}/#{pageSession.childType}", valueMap="#{pageSession.valueMap}");
setPageSessionAttribute(key="edit" value="#{false}" );
setPageSessionAttribute(key="showVirtualThreads" value="#{true}");
createMap(result="#{pageSession.valueMap2}")
mapPut(map="#{pageSession.valueMap}" key="enabled" value="true");
mapPut(map="#{pageSession.valueMap2}" key="enabled" value="true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# only if the new code is made subject to such option by the copyright
# holder.
#
# Portions Copyright 2022-2025 Payara Foundation and/or affiliates

## Concurrent

Expand Down Expand Up @@ -114,6 +115,7 @@ contextInfoLabelHelp=Container contexts to propagate to other threads. If disabl
threadPriorityLabel=Thread Priority:
threadPriorityLabelHelp=Priority to assign to created threads
longRunningTasks=Long-Running Tasks:
usevirtualthreads=Use Virtual Threads:
useforkjoinpool=Use ForkJoinPool:
longRunningTasksHelp=Use the resource for long-running tasks. If enabled, long-running tasks are not reported as stuck.
hungAfterSeconds=Hung After:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2022-2024] Payara Foundation and/or affiliates
// Portions Copyright 2022-2025 Payara Foundation and/or affiliates
package org.glassfish.concurrent.config;

import com.sun.enterprise.config.modularity.ConfigBeanInstaller;
Expand Down Expand Up @@ -125,21 +125,6 @@ public interface ManagedExecutorService extends ConfigBeanProxy, Resource,
*/
void setUseForkJoinPool(String value) throws PropertyVetoException;

/**
* Gets the value of the useVirtualThreads property.
*
* @return possible object is {@link String }
*/
@Attribute(defaultValue = "false", dataType = Boolean.class)
String getUseVirtualThreads();

/**
* Sets the value of the useVirtualThreads property.
*
* @param value allowed object is {@link String }
*/
void setUseVirtualThreads(String value) throws PropertyVetoException;

@DuckTyped
String getIdentity();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2022] Payara Foundation and/or affiliates
// Portions Copyright [2022-2025] Payara Foundation and/or affiliates

package org.glassfish.concurrent.config;

Expand Down Expand Up @@ -160,6 +160,21 @@ public interface ManagedExecutorServiceBase extends ConfigBeanProxy,
*/
void setThreadLifetimeSeconds(String value) throws PropertyVetoException;

/**
* Gets the value of the useVirtualThreads property.
*
* @return possible object is {@link String }
*/
@Attribute(defaultValue = "false", dataType = Boolean.class)
String getUseVirtualThreads();

/**
* Sets the value of the useVirtualThreads property.
*
* @param value allowed object is {@link String }
*/
void setUseVirtualThreads(String value) throws PropertyVetoException;

/**
* Gets the value of the context property.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2022] Payara Foundation and/or affiliates
// Portions Copyright [2022-2025] Payara Foundation and/or affiliates

package org.glassfish.concurrent.config;

Expand Down Expand Up @@ -94,6 +94,21 @@ public interface ManagedThreadFactory extends ConfigBeanProxy, Resource,
*/
void setThreadPriority(String value) throws PropertyVetoException;

/**
* Gets the value of the useVirtualThreads property.
*
* @return possible object is {@link String }
*/
@Attribute(defaultValue = "false", dataType = Boolean.class)
String getUseVirtualThreads();

/**
* Sets the value of the useVirtualThreads property.
*
* @param value allowed object is {@link String }
*/
void setUseVirtualThreads(String value) throws PropertyVetoException;

/**
* Gets the value of the context property.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2016-2024 Payara Foundation and/or its affiliates.
* Copyright (c) 2016-2025 Payara Foundation and/or its affiliates.
* All rights reserved.
*
* The contents of this file are subject to the terms of the Common Development
Expand All @@ -20,7 +20,7 @@
import org.glassfish.concurrent.config.ManagedScheduledExecutorService;
import org.glassfish.concurrent.runtime.ConcurrentRuntime;
import org.glassfish.concurrent.runtime.deployer.ManagedScheduledExecutorServiceConfig;
import org.glassfish.concurro.ManagedScheduledExecutorServiceImpl;
import org.glassfish.concurro.AbstractManagedExecutorService;
import org.glassfish.external.probe.provider.StatsProviderManager;
import org.glassfish.external.statistics.CountStatistic;
import org.glassfish.external.statistics.impl.CountStatisticImpl;
Expand All @@ -41,9 +41,8 @@ public class ManagedScheduledExecutorServiceStatsProvider
{
private final String name;
private boolean registered = false;
private final ManagedScheduledExecutorServiceImpl
managedScheduledExecutorServiceImpl;

private final AbstractManagedExecutorService managedScheduledExecutorServiceImpl;

private CountStatisticImpl completedTaskCount = new CountStatisticImpl(
"CompletedTaskCount", "count",
"Number of tasks completed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2021] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2025] [Payara Foundation and/or its affiliates]

package org.glassfish.concurrent.admin;

Expand Down Expand Up @@ -77,7 +77,7 @@ public class CreateManagedExecutorService extends CreateManagedExecutorServiceBa
@Param(name="taskqueuecapacity", alias="taskQueueCapacity", defaultValue=""+Integer.MAX_VALUE, optional=true)
private Integer taskqueuecapacity;

@Param(name="useforkjoinpool", alias="useForkJoinPool", defaultValue="false", optional=true)
@Param(name = "useforkjoinpool", alias = "useForkJoinPool", defaultValue = "false", optional = true)
protected Boolean useforkjoinpool;

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2016-2018] [Payara Foundation and/or its affiliates]
// Portions Copyright [2016-2025] [Payara Foundation and/or its affiliates]

package org.glassfish.concurrent.admin;

Expand Down Expand Up @@ -89,7 +89,10 @@ public class CreateManagedExecutorServiceBase {
@Param(name="threadlifetimeseconds", alias="threadLifetimeSeconds", defaultValue="0", optional=true)
protected Integer threadlifetimeseconds;

@Param(optional=true)
@Param(name = "usevirtualthreads", alias = "useVirtualThreads", defaultValue = "false", optional = true)
protected Boolean usevirtualthreads;

@Param(optional = true)
protected String description;

@Param(name="property", optional=true, separator=':')
Expand All @@ -114,6 +117,8 @@ protected void setAttributeList(HashMap attrList) {
keepaliveseconds.toString());
attrList.put(ResourceConstants.THREAD_LIFETIME_SECONDS,
threadlifetimeseconds.toString());
attrList.put(ResourceConstants.USE_VIRTUAL_THREADS,
usevirtualthreads.toString());
attrList.put(ServerTags.DESCRIPTION, description);
attrList.put(ResourceConstants.ENABLED, enabled.toString());
}
Expand Down
Loading