Unidata / netcdf-java

The Unidata netcdf-java library
https://docs.unidata.ucar.edu/netcdf-java/current/userguide/index.html
BSD 3-Clause "New" or "Revised" License
143 stars 68 forks source link

Unlock enhanced datasets #1303

Closed tdrwenski closed 5 months ago

tdrwenski commented 5 months ago

Description of Changes

This change ensures that "wrapped" datasets created from NetcdfDataset.enhance or from netcdfDataset.toBuilder can close the original NetcdfDataset if it was acquired from the cache. A new wrapped NetcdfDataset cannot directly close the original in the cache when close is called, but it can delegate this to the origFile. So the origFile needs to point to whatever the wrapped object is. This makes the behavior between enhanced NetcdfDatasets and NetcdfFiles the same.

Add tests for this. Note before the fix tests two and four (shouldReleaseLockOnNetcdfDatasetUsingBuilder and shouldReleaseLockOnAggregation) failed.

Jenkins tests are passing on this branch: https://jenkins-aws.unidata.ucar.edu/view/Users/job/tara-netcdf-java/47/