This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 2fb2029672 Move the virtual thread executor from modules to the main code 2fb2029672 is described below commit 2fb202967203446c401bf0d5bdaa05ccba1a3541 Author: Mark Thomas <ma...@apache.org> AuthorDate: Fri May 12 09:51:43 2023 +0100 Move the virtual thread executor from modules to the main code --- .../catalina/core/VirtualThreadExecutor.java | 27 +++++++++++----------- webapps/docs/changelog.xml | 6 +++++ webapps/docs/config/executor.xml | 20 ++++++++++++++-- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/modules/loom/src/main/java/org/apache/catalina/core/LoomExecutor.java b/java/org/apache/catalina/core/VirtualThreadExecutor.java similarity index 60% rename from modules/loom/src/main/java/org/apache/catalina/core/LoomExecutor.java rename to java/org/apache/catalina/core/VirtualThreadExecutor.java index d4ae23b021..b5ed201b16 100644 --- a/modules/loom/src/main/java/org/apache/catalina/core/LoomExecutor.java +++ b/java/org/apache/catalina/core/VirtualThreadExecutor.java @@ -1,18 +1,18 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.apache.catalina.core; @@ -24,7 +24,7 @@ import org.apache.catalina.util.LifecycleMBeanBase; /** * An executor that uses a new virtual thread for each task. */ -public class LoomExecutor extends LifecycleMBeanBase implements Executor { +public class VirtualThreadExecutor extends LifecycleMBeanBase implements Executor { private String name; private Thread.Builder threadBuilder; @@ -43,6 +43,7 @@ public class LoomExecutor extends LifecycleMBeanBase implements Executor { threadBuilder.start(command); } + @Override protected void startInternal() throws LifecycleException { threadBuilder = Thread.ofVirtual().name(getName() + "-", 0); @@ -65,4 +66,4 @@ public class LoomExecutor extends LifecycleMBeanBase implements Executor { protected String getObjectNameKeyProperties() { return "type=Executor,name=" + getName(); } -} +} \ No newline at end of file diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index f32f27e33e..17824fc5f1 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -129,6 +129,12 @@ current default separator character of <code>*</code> remains unchanged. (markt) </scode> + <add> + Add <code>org.apache.catalina.core.VirtualThreadExecutor</code>, a + virtual thread based executor that may be used with one or more + Connectors to process requests received by those Connectors using + virtual threads. (markt) + </add> </changelog> </subsection> </section> diff --git a/webapps/docs/config/executor.xml b/webapps/docs/config/executor.xml index 05b1420b8e..9c04ac673a 100644 --- a/webapps/docs/config/executor.xml +++ b/webapps/docs/config/executor.xml @@ -77,8 +77,12 @@ <subsection name="Standard Implementation"> - <p> - The default implementation supports the following attributes:</p> + <p>This implemtenation uses a pool of platform threads to execute the tasks assigned to the Executor.</p> + + <p>The <code>className</code> attribute must be <code>org.apache.catalina.core.StandardThreadExecutor</code> to use + this implementation.</p> + + <p>The standard implementation supports the following attributes:</p> <attributes> @@ -118,6 +122,18 @@ </subsection> + + <subsection name="Virtual Thread Implementation"> + + <p>This implemtenation uses a new virtual thread to execute each task assigned to the Executor.</p> + + <p>The <code>className</code> attribute must be <code>org.apache.catalina.core.VirtualThreadExecutor</code> to use + this implementation.</p> + + <p>The virtual thread implementation does not support any additional attributes.</p> + + </subsection> + </section> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org