mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-13 04:47:12 +02:00
-Vacuum before exit
This commit is contained in:
parent
e69184f726
commit
b1da373fef
@ -27,6 +27,14 @@ public final class DBTools {
|
||||
}
|
||||
}
|
||||
|
||||
public static void vaccum() throws SQLException {
|
||||
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); Statement stat = conn.createStatement()) {
|
||||
|
||||
stat.execute("VACUUM");
|
||||
}
|
||||
}
|
||||
|
||||
public static void insertDownload(String url, String path, String filename, String filekey, Long size, String filepass, String filenoexpire) throws SQLException {
|
||||
|
||||
try (Connection conn = SqliteSingleton.getInstance().getConn(); PreparedStatement ps = conn.prepareStatement("INSERT INTO downloads (url, path, filename, filekey, filesize, filepass, filenoexpire) VALUES (?,?,?,?,?,?,?)")) {
|
||||
|
@ -31,6 +31,7 @@ import java.util.concurrent.ExecutorService;
|
||||
import static java.util.concurrent.Executors.newCachedThreadPool;
|
||||
import java.util.logging.Level;
|
||||
import static java.util.logging.Level.SEVERE;
|
||||
import java.util.logging.Logger;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
||||
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
|
||||
@ -340,6 +341,8 @@ public final class MainPanel {
|
||||
|
||||
public void _byebye() {
|
||||
|
||||
boolean exit = true;
|
||||
|
||||
if(!_streamserver.getWorking_threads().isEmpty()) {
|
||||
|
||||
Object[] options = {"No",
|
||||
@ -352,9 +355,9 @@ public final class MainPanel {
|
||||
options,
|
||||
options[0]);
|
||||
|
||||
if(n==1) {
|
||||
if(n==0) {
|
||||
|
||||
exit(0);
|
||||
exit=false;
|
||||
}
|
||||
|
||||
} else if(!getDownload_manager().getTransference_provision_queue().isEmpty() || !getUpload_manager().getTransference_provision_queue().isEmpty()) {
|
||||
@ -369,16 +372,22 @@ public final class MainPanel {
|
||||
options,
|
||||
options[0]);
|
||||
|
||||
if(n==1) {
|
||||
if(n==0) {
|
||||
|
||||
exit(0);
|
||||
exit=false;
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
if(exit) {
|
||||
|
||||
try {
|
||||
DBTools.vaccum();
|
||||
} catch (SQLException ex) {
|
||||
Logger.getLogger(MainPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -648,8 +648,7 @@ public final class MainPanelView extends javax.swing.JFrame {
|
||||
}//GEN-LAST:event_about_menuActionPerformed
|
||||
|
||||
private void exit_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit_menuActionPerformed
|
||||
|
||||
|
||||
|
||||
_main_panel._byebye();
|
||||
}//GEN-LAST:event_exit_menuActionPerformed
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user