-Shutdown fix
This commit is contained in:
tonikelope 2016-10-26 18:47:40 +02:00
parent 6b5ac57673
commit 824394ba59
6 changed files with 74 additions and 22 deletions

View File

@ -520,7 +520,6 @@ public final class Download implements Transference, Runnable, SecureNotifiable
_thread_pool.shutdown(); _thread_pool.shutdown();
while (!_thread_pool.isTerminated()) {
try { try {
_thread_pool.awaitTermination(MAX_WAIT_WORKERS_SHUTDOWN, TimeUnit.SECONDS); _thread_pool.awaitTermination(MAX_WAIT_WORKERS_SHUTDOWN, TimeUnit.SECONDS);
@ -528,7 +527,6 @@ public final class Download implements Transference, Runnable, SecureNotifiable
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
getLogger(Download.class.getName()).log(SEVERE, null, ex); getLogger(Download.class.getName()).log(SEVERE, null, ex);
} }
}
if (!_thread_pool.isTerminated()) { if (!_thread_pool.isTerminated()) {

View File

@ -335,7 +335,14 @@ public final class DownloadView extends javax.swing.JPanel implements Transferen
private void close_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_close_buttonActionPerformed private void close_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_close_buttonActionPerformed
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
_download.close(); _download.close();
}
});
}//GEN-LAST:event_close_buttonActionPerformed }//GEN-LAST:event_close_buttonActionPerformed
private void copy_link_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copy_link_buttonActionPerformed private void copy_link_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copy_link_buttonActionPerformed
@ -347,17 +354,39 @@ public final class DownloadView extends javax.swing.JPanel implements Transferen
private void restart_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restart_buttonActionPerformed private void restart_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restart_buttonActionPerformed
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
_download.restart(); _download.restart();
}
});
}//GEN-LAST:event_restart_buttonActionPerformed }//GEN-LAST:event_restart_buttonActionPerformed
private void stop_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stop_buttonActionPerformed private void stop_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stop_buttonActionPerformed
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
_download.stop(); _download.stop();
}
});
}//GEN-LAST:event_stop_buttonActionPerformed }//GEN-LAST:event_stop_buttonActionPerformed
private void pause_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pause_buttonActionPerformed private void pause_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pause_buttonActionPerformed
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
_download.pause(); _download.pause();
}
});
}//GEN-LAST:event_pause_buttonActionPerformed }//GEN-LAST:event_pause_buttonActionPerformed
@Override @Override

View File

@ -9,7 +9,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.logging.Level.SEVERE; import static java.util.logging.Level.SEVERE;
import static java.util.logging.Logger.getLogger; import static java.util.logging.Logger.getLogger;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeModel; import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode; import javax.swing.tree.TreeNode;

View File

@ -58,7 +58,7 @@ import static megabasterd.Transference.MAX_TRANSFERENCE_SPEED_DEFAULT;
*/ */
public final class MainPanel { public final class MainPanel {
public static final String VERSION = "1.42"; public static final String VERSION = "1.43";
public static final int THROTTLE_SLICE_SIZE = 16 * 1024; public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int STREAMER_PORT = 1337; public static final int STREAMER_PORT = 1337;
public static final int WATCHDOG_PORT = 1338; public static final int WATCHDOG_PORT = 1338;

View File

@ -734,7 +734,6 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
_thread_pool.shutdown(); _thread_pool.shutdown();
while (!_thread_pool.isTerminated()) {
try { try {
_thread_pool.awaitTermination(MAX_WAIT_WORKERS_SHUTDOWN, TimeUnit.SECONDS); _thread_pool.awaitTermination(MAX_WAIT_WORKERS_SHUTDOWN, TimeUnit.SECONDS);
@ -742,7 +741,6 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex); getLogger(Upload.class.getName()).log(Level.SEVERE, null, ex);
} }
}
if (!_thread_pool.isTerminated()) { if (!_thread_pool.isTerminated()) {

View File

@ -335,22 +335,50 @@ public final class UploadView extends javax.swing.JPanel implements Transference
}//GEN-LAST:event_slots_spinnerStateChanged }//GEN-LAST:event_slots_spinnerStateChanged
private void close_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_close_buttonActionPerformed private void close_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_close_buttonActionPerformed
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
_upload.close(); _upload.close();
}
});
}//GEN-LAST:event_close_buttonActionPerformed }//GEN-LAST:event_close_buttonActionPerformed
private void restart_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restart_buttonActionPerformed private void restart_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restart_buttonActionPerformed
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
_upload.restart(); _upload.restart();
}
});
}//GEN-LAST:event_restart_buttonActionPerformed }//GEN-LAST:event_restart_buttonActionPerformed
private void stop_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stop_buttonActionPerformed private void stop_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stop_buttonActionPerformed
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
_upload.stop(); _upload.stop();
}
});
}//GEN-LAST:event_stop_buttonActionPerformed }//GEN-LAST:event_stop_buttonActionPerformed
private void pause_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pause_buttonActionPerformed private void pause_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pause_buttonActionPerformed
THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
_upload.pause(); _upload.pause();
}
});
}//GEN-LAST:event_pause_buttonActionPerformed }//GEN-LAST:event_pause_buttonActionPerformed