This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
This is mine application logic against reading-writing data from/to database file :
1) application reads data in memory (HashMap) from database file only when :
1_1) button "Execute" is pressed after user set dblocation and serverportnumber on the GUI in "server" mode 1_2) the application is started in "alone" mode;
when the application starts in "server" or "alone" modes (see "1_1" and "1_2" above) i set up a class for managing secure exit as follows : Runtime.getRuntime().addShutdownHook(SecureExit());
2) the application writes data from memory (HashMap) to database file only in one point - in the class "SecureExit()" (see above) and "SecureExit()" is not called in my code explicitly (i.e. SecureExit() is activated only by JVM).