suncertify.db.util
Class DbFileGuard

java.lang.Object
  |
  +--suncertify.db.util.DbFileGuard

public class DbFileGuard
extends java.lang.Object

Simple class allowing exclusion control to the random access file

See Also:
RandomAccessFile

Constructor Summary
DbFileGuard(java.lang.String fileName)
          Constructor for DbFileGuard class.
 
Method Summary
 void closeDBFile()
          The method close the file
 void finalize()
          somebody should close the file at the end, do not relay on this as nobody knows when it will be called
 java.io.RandomAccessFile getDBFile()
          The method gets exclusive access to the file, returns the data base access file
 void releaseDBFile()
          The method releases the exclusive access, so othres threads may use the file
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbFileGuard

public DbFileGuard(java.lang.String fileName)
            throws java.io.FileNotFoundException
Constructor for DbFileGuard class. It internally opens requested file

Throws:
java.io.FileNotFoundException - - thrown if file was not found
Method Detail

getDBFile

public java.io.RandomAccessFile getDBFile()
The method gets exclusive access to the file, returns the data base access file

Returns:
database file

releaseDBFile

public void releaseDBFile()
The method releases the exclusive access, so othres threads may use the file


closeDBFile

public void closeDBFile()
The method close the file


finalize

public void finalize()
somebody should close the file at the end, do not relay on this as nobody knows when it will be called

Overrides:
finalize in class java.lang.Object