本文介绍了如果在finalize()期间抛出异常会怎样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在执行finalize()期间引发异常,将会发生什么?
堆栈是否像通常那样展开?它是否继续finalize()并忽略异常?它会停止finalize()并继续GC该对象吗?或者是其他东西?

What would happen if an exception is thrown during the execution of finalize()?Is the stack unwind like normally? Does it continue finalize() and ignore the exception? Does it stop finalize() and continue GC the object? Or something else?

我不是在寻找使用finalize()的准则,有很多页面对此进行了解释。

I'm not looking for guidelines of using finalize() there are plently of pages explaining that.

推荐答案

来自 javadoc:

From the Object#finalize() javadoc:

这篇关于如果在finalize()期间抛出异常会怎样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 07:09