1. 程式人生 > >對方法進行執行緒處理

對方法進行執行緒處理

1對方法實現runable

class threadEnterpriseGrabOther implements Runnable{
        String companyId = "";
        String company = "";
        String sys_language="";
        public threadEnterpriseGrabOther(String companyId, String company,
                String sys_language) {
            super();
            
this.companyId = companyId; this.company = company; this.sys_language = sys_language; } @Override public void run() { try { enterpriseGrabOther(companyId,company,sys_language); } catch (Exception e) {
// TODO Auto-generated catch block e.printStackTrace(); } } }

2呼叫

//執行緒爬取企查查裁判文書,法院公告,開庭公告資訊資料並儲存
            Thread th=new Thread(new threadEnterpriseGrabOther(companyId, companyName, sys_language));
            th.start();