Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果抛出未捕获的异常,并且您想通过重新启动与刚刚抛出异常的线程相同的线程来恢复(例如,JMS 连接丢失),最简单的方法是什么?
该类从 Thread 扩展而来,并且该线程具有 UncaughtExceptionHandler。
The easiest thing to do is to "restart" the current thread via the run() method
void run() { boolean done = false; while(!done) { try { ... done = true; } catch (ConnectionLostException ex) { // log exception } } }