带有 tomcat-jdbc 连接池的 Jetty

Jetty with tomcat-jdbc connection pool

Jetty 手册提供了 BoneCP、c3p0、DBCP 的连接池示例,但没有 tomcat-jdbc。 是否可以使用 tomcat-jdbc 连接池配置 Jetty?

我一直在 jetty 9.3 和 tomcat-jdbc 7.0.72

中使用此配置
  <!-- =========================================================== -->
  <!-- DataSource                                                  -->
  <!-- =========================================================== -->

  <New id="rfid" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>jdbc/rfid</Arg>
    <Arg>
      <New class="org.apache.tomcat.jdbc.pool.DataSource">
        <Set name="driverClassName">oracle.jdbc.OracleDriver</Set>
        <Set name="url">jdbc:oracle:thin:@integra:1521:integra</Set>
        <Set name="username">user</Set>
        <Set name="password">password</Set>
        <Set name="defaultAutoCommit">false</Set>
        <Set name="jmxEnabled">true</Set>
        <Set name="testWhileIdle">false</Set>
        <Set name="testOnBorrow">true</Set>
        <Set name="testOnReturn">false</Set>
        <Set name="validationQuery">SELECT 1 FROM dual</Set>
        <Set name="validationInterval">30000</Set>
        <Set name="minEvictableIdleTimeMillis">30000</Set>
        <Set name="timeBetweenEvictionRunsMillis">30000</Set>
        <Set name="initialSize">8</Set>
        <Set name="minIdle">8</Set>
        <Set name="maxIdle">8</Set>
        <Set name="maxActive">10</Set>
        <Set name="maxWait">30000</Set>
        <Set name="removeAbandonedTimeout">120</Set>
        <Set name="logAbandoned">true</Set>
        <Set name="removeAbandoned">true</Set>
        <Set name="jdbcInterceptors">
          org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport(threshold=2000);
          org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx;
        </Set>
      </New>
    </Arg>
  </New>

  <New id="myphoto" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>jdbc/myphoto</Arg>
    <Arg>
      <New class="org.apache.tomcat.jdbc.pool.DataSource">
        <Set name="driverClassName">com.mysql.jdbc.Driver</Set>
        <Set name="url">jdbc:mysql://localhost:3306/myphotoipb?zeroDateTimeBehavior=convertToNull&amp;useSSL=false</Set>
        <Set name="username">myphoto</Set>
        <Set name="password">password</Set>
        <Set name="defaultAutoCommit">false</Set>
        <Set name="jmxEnabled">true</Set>
        <Set name="testWhileIdle">false</Set>
        <Set name="testOnBorrow">true</Set>
        <Set name="testOnReturn">false</Set>
        <Set name="validationQuery">SELECT 1 FROM dual</Set>
        <Set name="validationInterval">30000</Set>
        <Set name="minEvictableIdleTimeMillis">30000</Set>
        <Set name="timeBetweenEvictionRunsMillis">30000</Set>
        <Set name="initialSize">2</Set>
        <Set name="minIdle">4</Set>
        <Set name="maxIdle">8</Set>
        <Set name="maxActive">10</Set>
        <Set name="maxWait">30000</Set>
        <Set name="removeAbandonedTimeout">120</Set>
        <Set name="logAbandoned">true</Set>
        <Set name="removeAbandoned">true</Set>
        <Set name="jdbcInterceptors">
          org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport(threshold=2000);
          org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx;
        </Set>
      </New>
    </Arg>
  </New>