private void checkState ( ) throws H2DBLockException { if ( ! lockFile . getParentFile ( ) . isDirectory ( ) && ! lockFile . mkdir ( ) ) { throw new H2DBLockException ( "Unable to create path to data directory." ) ; } if ( lockFile . isFile ( ) ) { //TODO - this 30 minute check needs to be configurable. if ( getFileAge ( lockFile ) > 30 ) { LOGGER . debug ( "An old db update lock file was found: {}" , lockFile . getAbsolutePath ( ) ) ; if ( ! lockFile . delete ( ) ) { LOGGER . warn ( "An old db update lock file was found but the system was unable to delete " + "the file. Consider manually deleting {}" , lockFile . getAbsolutePath ( ) ) ; } } else { LOGGER . info ( "Lock file found `{}`" , lockFile ) ; LOGGER . info ( "Existing update in progress; waiting for update to complete" ) ; } } }
Checks the state of the custom h2 lock file and under some conditions will attempt to remove the lock file .