用一个类类继承Thread,并实现run方法,在run方法中写相关实现逻辑

Future future = MyThreadPool.submit(qdt);

 

 

/**
     *  等待各个线程任务完成
     * @param futures
     */
    @SuppressWarnings("rawtypes")
    private void waitForThreads(List<Future> futures) {
        if (futures != null) {
            for (Future future : futures) {
                try {
                    future.get();
                } catch (InterruptedException | ExecutionException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
    }

posted on 2015-12-20 15:37  风又奈何  阅读(169)  评论(0)    收藏  举报