⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 theadmain.java

📁 用java写一个线程池的例子,值得一看.
💻 JAVA
字号:

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2007-11-13
 * Time: 17:35:10
 * To change this template use Options | File Templates.
 */

import java.util.Vector;
import java.util.Properties;
import java.io.InputStream;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2007-9-27
 * Time: 0:16:42
 * To change this template use Options | File Templates.
 */
public class TheadMain {
  public static void main(String[] args) throws Exception {

      /*
      Properties   tmpProps   =   new   Properties();
      InputStream   tmpIs   =   Class.forName("xxx.java").getResourceAsStream("x.ini");
        tmpProps.load(tmpIs);
      tmpProps.setProperty("err","ee") ;

      */

      /*

      String srcString = "test:man:";
      int i_pos = srcString.indexOf(":");
      String outString =  srcString.substring(i_pos+1,srcString.length()-1);
      System.out.print(outString);

            Manager ThreadPoolMain;
      ThreadPoolMain = ManagerImpl.getInstance();
        String sysdate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new java.util.Date());
      String ls = "test.abx.exe" ;
      System.out.print(ls.indexOf("test"));
        System.out.println("开始执行:"+sysdate);
           {
            Vector lists =new Vector();
            for (int i = 0; i < 5; i++) {
                WorkerImpl workThread = null ;
                while(workThread ==null) {
                   workThread = ThreadPoolMain.getIdleWorker() ;
                   if (workThread !=null) {
                       /*
                       try{
                       workThread.setList(lists);
                       workThread.notifyToStart();
                       Thread.sleep(100000);
                       }
                       catch(Exception ex)
                       {
                       }
                       */

      /*
                     if ( workThread.s){
                         System.out.print(workThread.getThreadName()+" not IsRunning \n");
                     }
                       else
                     {
                        System.out.print(workThread.getThreadName()+" is IsRunning \n");
                     }
                   };
                   Thread.sleep(2);
                }
            }

           }
         while(!(ThreadPoolMain.getActiveThread()==0)){
                      Thread.sleep(10);
       }

         sysdate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(new java.util.Date());
        System.out.println("\n结束执行:"+sysdate);

        */




  }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -