zoukankan      html  css  js  c++  java
  • 建立一个每隔10秒执行的线程

    //线程类
    public class TestThread extends Thread {
        public void run() {
            while(true){
                try {
                    sleep(6*1000);
                                    //这里可以写你自己要运行的逻辑代码
                    System.out.println("一分钟运行一次");
                catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                 
            }
        }
    }
    //运行线程类MAIN
    public class TestThreadMain {
     
        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            TestThread testThread = new TestThread();
            testThread.start();
        }
     
    }
  • 相关阅读:
    区块链
    黑帽内容整理
    编程语言
    编程语言
    PHP
    安全体系建设-OWASP
    burp
    编程语言-Python-GUI
    加解密
    结合自己的程序对thinkphp模板常量的理解
  • 原文地址:https://www.cnblogs.com/kongxc/p/7965707.html
Copyright © 2011-2022 走看看