Stanley Bradbury wrote:
> Tim Dudgeon wrote:
>>
>>
>> I'm wanting to provide some feedback in my application when a derby
>> database is opened and it was not shutdown properly last time it was
>> used.
>>
>> 2 files seem to be created, db.lck and dbex.lck and are not deleted
>> when the db is not shutdown cleanly.
>>
>> Is there a way of distinguishing between the presence of these files
>> being the result of a current process holding a lock on an open
>> database (in which case the database cannot be opened) and it being
>> the result of a bad shutdown, in which case the database can be
>> opened, but there may be a delay whilst it is opened.
>>
>> thanks
>>
>> Tim
>>
>>
> Hi Tim -
> As you indicate, check if the files are locked by a process - if they
> are then the database is most likely in use by a Derby process. If they
> are not locked
So how best to do this? Is File.canWrite() sufficient?
then they are probably orphan files and then you can
> check for the number and size of the files in the 'log' subdirectory
Any files in particular? There always seems to be files in here.
> to
> see if there might be a delay due to recovery running when the DB is
> next booted. And I know you wouldn't do this but I feel compelled to
> mention that you should never directly manipulate these files in any way.
Of course :-)
Thanks
Tim
|