NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

[Fwd: Re: 20000503: NetcdfFile class in netcdf Java package]


-------- Original Message --------
Subject: Re: 20000503: NetcdfFile class in netcdf Java package
Date: Wed, 03 May 2000 12:47:50 -0600
From: Russ Rew <russ@xxxxxxxxxxxxxxxx>
Organization: UCAR Unidata Program
To: Yunqing Zhang <phoebe@xxxxxxxxxxxxxxxx>
CC: caron@xxxxxxxx, support-netcdf@xxxxxxxxxxxxxxxx

>To: support@xxxxxxxxxxxxxxxx
>From: Yunqing Zhang <phoebe@xxxxxxxxxxxxxxxx>
>Subject: NetcdfFile class in netcdf Java package
>Organization: Rutgers University
>Keywords: 200005031818.e43IIOG21941

Hi Phoebe,

> When I use the Java API to create and write a netcdf file, if I don't 
> explicitly call the close() method of my NetcdfFile object, there will
> be some data loss. Although it is not a good programming practice not
> to call close(), there should be no consequence whatsoever since NetcdfFile
> has a finalize() method to do it automatically. But it doesn't seem to be
> working in my case. Could you let me know what I miss here? I'd very
> apprecaite your help.

In order to make sure the finalize() method always gets called, I
think you have to call the class java.lang.System method
runFinalizersOnExit() with the argument true.  Otherwise, there are
situations in which a finalize() method may not get called.

--Russ