首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

finalize(),jdk文档,请求人将其译为中文,并提出意见。该怎么解决

2012-03-12 
finalize(),jdk文档,请求人将其译为中文,并提出意见。inalizeprotectedvoidfinalize()throwsThrowableCalle

finalize(),jdk文档,请求人将其译为中文,并提出意见。
inalize
protected   void   finalize()
                                  throws   Throwable
Called   by   the   garbage   collector   on   an   object   when   garbage   collection   determines   that   there   are   no   more   references   to   the   object.   A   subclass   overrides   the   finalize   method   to   dispose   of   system   resources   or   to   perform   other   cleanup.  
The   general   contract   of   finalize   is   that   it   is   invoked   if   and   when   the   JavaTM   virtual   machine   has   determined   that   there   is   no   longer   any   means   by   which   this   object   can   be   accessed   by   any   thread   that   has   not   yet   died,   except   as   a   result   of   an   action   taken   by   the   finalization   of   some   other   object   or   class   which   is   ready   to   be   finalized.   The   finalize   method   may   take   any   action,   including   making   this   object   available   again   to   other   threads;   the   usual   purpose   of   finalize,   however,   is   to   perform   cleanup   actions   before   the   object   is   irrevocably   discarded.   For   example,   the   finalize   method   for   an   object   that   represents   an   input/output   connection   might   perform   explicit   I/O   transactions   to   break   the   connection   before   the   object   is   permanently   discarded.  

The   finalize   method   of   class   Object   performs   no   special   action;   it   simply   returns   normally.   Subclasses   of   Object   may   override   this   definition.  

The   Java   programming   language   does   not   guarantee   which   thread   will   invoke   the   finalize   method   for   any   given   object.   It   is   guaranteed,   however,   that   the   thread   that   invokes   finalize   will   not   be   holding   any   user-visible   synchronization   locks   when   finalize   is   invoked.   If   an   uncaught   exception   is   thrown   by   the   finalize   method,   the   exception   is   ignored   and   finalization   of   that   object   terminates.  

After   the   finalize   method   has   been   invoked   for   an   object,   no   further   action   is   taken   until   the   Java   virtual   machine   has   again   determined   that   there   is   no   longer   any   means   by   which   this   object   can   be   accessed   by   any   thread   that   has   not   yet   died,   including   possible   actions   by   other   objects   or   classes   which   are   ready   to   be   finalized,   at   which   point   the   object   may   be   discarded.  



The   finalize   method   is   never   invoked   more   than   once   by   a   Java   virtual   machine   for   any   given   object.  

Any   exception   thrown   by   the   finalize   method   causes   the   finalization   of   this   object   to   be   halted,   but   is   otherwise   ignored.  




[解决办法]
你下个CHM格式的JDK API的中文帮助不是眩光可以了吗?
[解决办法]
坐在椅子上帮 "iambtk(猪头) "顶,
呵呵
[解决办法]
我来,哈哈
当垃圾回收器确定不存在对该对象的更多引用时,由对象的垃圾回收器调用此方法。子类重写 finalize 方法,以配置系统资源或执行其他清除。
finalize 的常规协定是:当 JavaTM 虚拟机已确定尚未终止的任何线程无法再通过任何方法访问此对象时,将调用此方法,除非由于准备终止的其他某个对象或类的终结操作执行了某个操作。finalize 方法可以采取任何操作,其中包括再次使此对象对其他线程可用;不过,finalize 的主要目的是在不可撤消地丢弃对象之前执行清除操作。例如,表示输入/输出连接的对象的 finalize 方法可执行显式 I/O 事务,以便在永久丢弃对象之前中断连接。

Object 类的 finalize 方法执行非特殊性操作;它仅执行一些常规返回。Object 的子类可以重写此定义。

Java 编程语言不保证哪个线程将调用某个给定对象的 finalize 方法。但可以保证在调用 finalize 时,调用 finalize 的线程将不会持有任何用户可见的同步锁定。如果 finalize 方法抛出未捕获的异常,那么该异常将被忽略,并且该对象的终结操作将终止。

在启用某个对象的 finalize 方法后,将不会执行进一步操作,直到 Java 虚拟机再次确定尚未终止的任何线程无法再通过任何方法访问此对象,其中包括由准备终止的其他对象或类执行的可能操作,在执行该操作时,对象可能被丢弃。

对于任何给定对象,Java 虚拟机最多只调用一次 finalize 方法。

finalize 方法抛出的任何异常都会导致此对象的终结操作停止,但可以通过其他方法忽略它。


抛出:
Throwable - 此方法抛出的 Exception

热点排行