Re: [netcdf-java] Variable object thread safe?


Jon Blower wrote:
> So presumably if you use the NetCDF file cache, you have to do the
> synchronization yourself, since you might be transparently sharing
> file handles?  That's an aspect of the cache that hadn't occurred to
> me before...

The way that the cache is designed to work is that you get back a NetcdfFile 
object, which should then used only in a single thread so you dont need 
synchronization ("thread-confinement"), such as to answer a single request in a 
server. Until you release that NetcdfFile object, no one else can get it from 
the cache. If another request is made for that same NetcdfFile while its 
locked, a new NetcdfFile is opened. 

And of course, the cache itself is thread-safe. So if you use it properly, you 
never have to do synchronization yourself.


  • 2008 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: