When Tomcat starts, start a thread

xiaoxiao2021-03-06  63

Package test; import javax.servlet. *;

public class MyCode implements ServletContextListener {// When Tomcat starts performs contextInitialized () public void contextInitialized (ServletContextEvent e) {new MyThread () start ();.} public void contextDestroyed (ServletContextEvent e) {} class MyThread extends Thread {public Void Run () {// .....}}} / * Web.xml

test.mycode * /

转载请注明原文地址:https://www.9cbs.com/read-86055.html

New Post(0)