サンプル
protected
void
finalize()
throws
Throwable {
try
{
getApplet().destroy();
}
finally
{
super
.finalize();
}
}
private
Applet
getApplet() {
if
(_applet ==
null
) {
_applet =
new
Applet();
}
return
_applet;
}
private
Applet
_applet =
null
;
解決策
finalize() メソッドの代わりに、明示的に呼び出されたクリーンアップ・メソッドを使用します。
protected
void
free() {
getApplet().destroy();
}
private
Applet
getApplet() {
if
(_applet ==
null
) {
_applet =
new
Applet();
}
return
_applet;
}
private
Applet
_applet =
null
;