git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@355
be28352e-c001-0410-b1a7-
c7978e42abec
*/
private void tidy() {
if (_lock!=null) {
- if ( advisory!=null)
+ if ( advisory!=null) {
advisory.release(true);
- advisory.target.deleteOnExit();
+ advisory.target.deleteOnExit();
+ }
advisory=null;
_lock=null;
}
}
public void release(boolean closeChannel) {
+ if (lock==null)
+ return;
try {
// channel.close should be called before release() for rigourous locking.
- if (rafile!=null && rafile.getFD().valid() && rafile.getChannel()!=null && lock.isValid()) {
+ if (lock.isValid() && rafile!=null && rafile.getFD().valid() && rafile.getChannel()!=null) {
if (closeChannel && rafile.getChannel().isOpen()) {
rafile.close();
rafile=null;