对于其他对象,通常最好避免终结器。
不要依赖于终结器作为释放资源的主要方式。
Don't rely on finalizers as the primary means of releasing resources.
这意味着该类的任何子类都无法声明终结器。
This means that no subclass of that class can declare a finalizer.
这会阻止终结器回收其他对象。
所以我删除了所有这些类型的终结器。
该漏洞是使用终结器来恢复对象的著名技术的一种变体。
The exploit is a variation of the well-known technique of using a finalizer for resurrecting an object.
无法保证终结器将在何时运行,或者甚至它是否会运行。
There is no guarantee when a finalizer will be run, or even if it will be run at all.
如果存在析构函数,则将其重写为类终结器。
If a destructor is present, rewrite that to be the class finalizer.
可以为所创建的类创建一个终结器并将它声明为final。
You can create a finalizer for the class you're creating and declare it as final.
将外部输入、终结器或状态添加到数据流图表中。
例如,无法在析构函数或终结器上请求一个新的槽。
For example, a new slot cannot be requested on a destructor or finalizer.
终结器可以使用此方法使自己或引用的对象重新起用。
A finalizer can use this method to resurrect itself or an object that it references.
空的终结器只会徒增这种系统开销,而没有一点好处。
An empty finalizer incurs this added overhead without any benefit.
终结器恢复即将被垃圾收集的能力无疑是终结机制工作方式的一种意外后果。
The ability of a finalizer to revive an object destined for garbage collection is clearly an unintended consequence of the way that the finalization mechanism works.
原因有很多,最重要的一个原因是,终结器很难正确编写(并且很容易编写错)。
There are a number of reasons, foremost of which is that finalizers are very tricky to write correctly (and very easy to write incorrectly).
此方法的缺点是,终结器的存在意味着对象的存活期比其他情况下更长。
The disadvantage of this approach is that the existence of the finalizer means that the object is kept alive longer than it otherwise would be.
应尽可能避免终结器,因为跟踪对象生存期会产生额外的性能系统开销。
Whenever you can, avoid finalizers because of the additional performance overhead that is involved in tracking object lifetime.
但是我被误导的一些文章,为实现在任何情况下,终结器的一次性模式。
However I was misguided by some articles into implementing the Diposable pattern with a Finalizer in any case.
终结器就是置于电缆终端的一个电阻负荷,用来防止数据信号又反射回到线路中去。
A resistive load placed at the end of a cable to prevent data signals from reflecting back into the data path.
终结器不仅难以编写正确,终结的定时也是不确定的,并且不能保证终结器最终会运行。
Not only is it difficult to code them correctly, but the timing of finalization is not deterministic, and there is no guarantee that finalizers will ever even run.
如果一个对象有些终结器,那么运行时只要在终结方法被调用后才对其执行垃圾回收。
The runtime cannot garbage collect objects with finalizers until after their finalization methods have been called.
在调用zombie终结器时,它获取被终结的对象(由this引用)并将它存储在静态zombie变量中。
When the zombie finalizer is called, it takes the object being finalized - referenced by this - and stores it in the static zombie variable.
当终结器引发它无法处理的异常时,运行时将把异常堆栈跟踪打印至控制台,然后允许终结器线程继续运行终结器。
When a finalizer throws an exception that it does not handle, the runtime prints the exception stack trace to the console and then allows the finalizer thread to resume running finalizers.
如果说平台库提供终结器来清除打开的文件句柄,这大大降低了忘记显式地关闭这些句柄的风险,为什么不更多地使用终结器呢?
If the platform libraries provide finalizers for cleaning up open file handlers, which greatly reduces the risk of forgetting to close them explicitly, why aren't finalizers used more often?
但是如果 props.load()方法抛出一个IOException,那么流则不会被关闭(直到垃圾收集器运行其终结器)。
method throws an IOException, then the stream will not be closed (until the garbage collector runs its finalizer).
测试员通过向服务器交付完成的测试脚本来终结任务。
Testers resolve the task by delivering the finished test scripts to the server.
最终结果是越来越多的侦听器被添加到伙伴列表,而且它们永远不会被删除。
The end result was that more and more listeners were added to the buddy list and never removed.
若没有留给垃圾回收器足够的空间用于垃圾整理,就会产生一个致命的内存异常,进程也将终结。
If the garbage collector does not have enough space for its collections you will get a fatal out of memory exception and the process will die.
上述举措不太可能终结新兴的电子阅读器市场的这种盘旋势头。
The moves aren't likely to end the gyrations in the nascent e-reader market.
上述举措不太可能终结新兴的电子阅读器市场的这种盘旋势头。
The moves aren't likely to end the gyrations in the nascent e-reader market.
应用推荐