eclipse中tomcat自動部署時自動中止問題processWorkerExit(w, comp

一、問題描述

            在eclipse或者集成eclipse的其餘開發工具中,在tomcat中部署了項目debug模式啓動項目,
      項目啓動以後修改項目java源代碼,eclipse會自動部署項目到tomcat中。
      但在tomcat自動重啓時會自動中止到processWorkerExit(w, completedAbruptly);這一行代碼上。
      
      
二、問題出現緣由
   
            緣由是由於在 java.util.concurrent.ThreadPoolExecutor類中的 runWorker(Worker w)方法上有未捕獲的異常信息,源代碼以下:
            可見在try以後並無catch語句。而在eclipse的java debug模式中就有「遇到未捕獲異常中止執行」的選項。只要不勾選該項就能夠解決該問題了。
            final void runWorker(Worker w) {
        Runnable task = w.firstTask;
        w.firstTask = null;
        boolean completedAbruptly = true;
        try {
            while (task != null || (task = getTask()) != null) {
                w.lock();
                clearInterruptsForTaskRun();
                try {
                    beforeExecute(w.thread, task);
                    Throwable thrown = null;
                    try {
                        task.run();
                    } catch (RuntimeException x) {
                        thrown = x; throw x;
                    } catch (Error x) {
                        thrown = x; throw x;
                    } catch (Throwable x) {
                        thrown = x; throw new Error(x);
                    } finally {
                        afterExecute(task, thrown);
                    }
                } finally {
                    task = null;
                    w.completedTasks++;
                    w.unlock();
                }
            }
            completedAbruptly = false;
        } finally {
            processWorkerExit(w, completedAbruptly);
        }
    }
 三、解決方案java

           去掉java->debug->suspend execution on uncaught exceptions 選項錢的對勾就好了。以下圖所示:tomcat

相關文章
相關標籤/搜索