mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-13 12:57:11 +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 {
|
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 (?,?,?,?,?,?,?)")) {
|
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 static java.util.concurrent.Executors.newCachedThreadPool;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import static java.util.logging.Level.SEVERE;
|
import static java.util.logging.Level.SEVERE;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import static java.util.logging.Logger.getLogger;
|
import static java.util.logging.Logger.getLogger;
|
||||||
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
||||||
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
|
import static javax.swing.JOptionPane.YES_NO_CANCEL_OPTION;
|
||||||
@ -340,6 +341,8 @@ public final class MainPanel {
|
|||||||
|
|
||||||
public void _byebye() {
|
public void _byebye() {
|
||||||
|
|
||||||
|
boolean exit = true;
|
||||||
|
|
||||||
if(!_streamserver.getWorking_threads().isEmpty()) {
|
if(!_streamserver.getWorking_threads().isEmpty()) {
|
||||||
|
|
||||||
Object[] options = {"No",
|
Object[] options = {"No",
|
||||||
@ -352,9 +355,9 @@ public final class MainPanel {
|
|||||||
options,
|
options,
|
||||||
options[0]);
|
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()) {
|
} else if(!getDownload_manager().getTransference_provision_queue().isEmpty() || !getUpload_manager().getTransference_provision_queue().isEmpty()) {
|
||||||
@ -369,16 +372,22 @@ public final class MainPanel {
|
|||||||
options,
|
options,
|
||||||
options[0]);
|
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);
|
exit(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,7 +649,6 @@ public final class MainPanelView extends javax.swing.JFrame {
|
|||||||
|
|
||||||
private void exit_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit_menuActionPerformed
|
private void exit_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exit_menuActionPerformed
|
||||||
|
|
||||||
|
|
||||||
_main_panel._byebye();
|
_main_panel._byebye();
|
||||||
}//GEN-LAST:event_exit_menuActionPerformed
|
}//GEN-LAST:event_exit_menuActionPerformed
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user