Atitit 嵌入式tomcat 嵌入式服务器 attilax 你感觉艾提拉 总结 比起嵌入jetty ,文件可以自动刷新貌似还不错。。方便调试debug package com.attilax.

Atitit 嵌入式tomcat 嵌入式服务器 attilax 你感觉艾提拉 总结

 

比起嵌入jetty ,文件可以自动刷新貌似还不错。。方便调试debug

 

package com.attilax.web;

 

import java.io.File;

 

import org.apache.catalina.LifecycleException;

import org.apache.catalina.core.AprLifecycleListener;

import org.apache.catalina.core.StandardServer;

import org.apache.catalina.startup.ClassLoaderFactory;

import org.apache.catalina.startup.Tomcat;

 

import com.attilax.io.pathx;

import com.attilax.util.Global;

 

import javax.servlet.ServletException;

 

/**

 * Created by nil on 2014/8/1.

 */

public class EmbeddedTomcat {

    private Tomcat tomcat;

 

    private void startTomcat(int port, String contextPath, String baseDir)

            throws ServletException, LifecycleException {

        tomcat = new Tomcat();

        tomcat.setPort(port);

        tomcat.setBaseDir(".");

        StandardServer server = (StandardServer) tomcat.getServer();

        AprLifecycleListener listener = new AprLifecycleListener();

        server.addLifecycleListener(listener);

        tomcat.addWebapp(contextPath, baseDir);

        tomcat.start();

    }

 

    private void stopTomcat() throws LifecycleException {

        tomcat.stop();

    }

 

    public static void main(String[] args) {

     System.out.println("");

        try {

            int port = 80;

            String contextPath = "/";

            String baseDir =pathx.webAppPath_jensyegeor();

             //new File("webroot").getAbsolutePath();  // 项目中web目录名称,以前版本为WebRootwebappwebapps,现在为WebContent

            EmbeddedTomcat tomcat = new EmbeddedTomcat();

            tomcat.startTomcat(port, contextPath, baseDir);

            // 由于Tomcatstart方法为非阻塞方法,加一个线程睡眠模拟线程阻塞.

            

            

            String heartbeat_str = "--tomcat run. heartbeat_str";

           Global.heartbeatRecycle(heartbeat_str);

           

        } catch (Exception e) {

            e.printStackTrace();

        }

    }

}

 

配置简单的嵌入式tomcat - CSDN博客.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以在你的代码中使用计时器来计算代码的执行时间。在C++中,你可以使用`<chrono>`头文件中的`high_resolution_clock`来实现计时。下面是一个示例代码,展示了如何在你的代码中添加计时器: ```cpp #include <iostream> #include <chrono> int main() { // 开始计时 auto start = std::chrono::high_resolution_clock::now(); // 你的代码 string directoryPath = "C:\\BC\\RRRR"; DeleteFilesInDirectory(directoryPath); // 结束计时 auto end = std::chrono::high_resolution_clock::now(); // 计算执行时间 auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count(); // 输出执行时间 std::cout << "代码执行时间: " << duration << " 毫秒" << std::endl; return 0; } ``` 这段代码会在你的代码执行前开始计时,在代码执行完后结束计时,并计算出执行时间。最后,它会输出执行时间。你可以根据需要将计时单位更改为其他单位,比如秒或微秒。 #### 引用[.reference_title] - *1* *2* *3* [Atitit zip解压文件 java use apache ant.jar C:\0wkspc\hislog\src\main\java\com\attilax\compress\ZipUt](https://blog.csdn.net/attilax/article/details/80272336)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值