java開啟多線程執行延時操作


//刪除之前的信息
            if (count > 0) {
                // 多線程處理
                new Thread() {
                    @SuppressWarnings("unchecked")
                    public void run() {
                        int num = 0;
                        Map<String, String> map = null;
                        String sql = "update user set status=1 where id=? ";
                        //三分鍾
                        while (num < 90) {
                            try {
                                Thread.sleep(2000);
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                            for (String item : listOrderId) {
                                SqlMapExe.executeUpdate(sql, new String[]{item});
                                logger.info("########################多線程執行SQL:" + sql + "參數:" + item + "################################end");
                            }
                            num++;
                        }
                    }
                }.start();
            }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM