<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">

<Configure>
  <New id="threadPool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
    <Set name="name" property="jetty.threadPool.namePrefix" />
    <Set name="minThreads" type="int"><Property name="jetty.threadPool.minThreads" deprecated="threads.min" default="10"/></Set>
    <Set name="maxThreads" type="int"><Property name="jetty.threadPool.maxThreads" deprecated="threads.max" default="200"/></Set>
    <Set name="reservedThreads" type="int"><Property name="jetty.threadPool.reservedThreads" default="-1"/></Set>
    <Set name="idleTimeout" type="int"><Property name="jetty.threadPool.idleTimeout" deprecated="threads.timeout" default="60000"/></Set>
    <Set name="maxEvictCount" type="int"><Property name="jetty.threadPool.maxEvictCount" default="1"/></Set>
    <Set name="detailedDump" type="boolean"><Property name="jetty.threadPool.detailedDump" default="false"/></Set>
    <Get id="namePrefix" name="name" />
    <Call class="java.lang.Thread" name="ofVirtual">
      <Call class="java.lang.Thread$Builder" name="name">
        <Arg>
          <Property name="jetty.threadPool.virtual.namePrefix">
            <Default><Ref refid="namePrefix" />-virtual-</Default>
          </Property>
        </Arg>
        <Arg type="long">0</Arg>
        <Call class="java.lang.Thread$Builder" name="allowSetThreadLocals">
          <Arg type="boolean"><Property name="jetty.threadPool.virtual.allowSetThreadLocals" default="true" /></Arg>
          <Call class="java.lang.Thread$Builder" name="inheritInheritableThreadLocals">
            <Arg type="boolean"><Property name="jetty.threadPool.virtual.inheritInheritableThreadLocals" default="false" /></Arg>
            <Call id="virtualThreadFactory" class="java.lang.Thread$Builder" name="factory" />
          </Call>
        </Call>
      </Call>
    </Call>
    <Call name="setVirtualThreadsExecutor">
      <Arg>
        <Call class="java.util.concurrent.Executors" name="newThreadPerTaskExecutor">
          <Arg><Ref refid="virtualThreadFactory" /></Arg>
        </Call>
      </Arg>
    </Call>
  </New>

  <Call class="org.slf4j.LoggerFactory" name="getLogger">
    <Arg>org.eclipse.jetty</Arg>
    <Call name="warn">
      <Arg>Virtual threads are a Java Preview Feature, support may be limited.</Arg>
    </Call>
  </Call>
</Configure>
