mirror of
https://github.com/tonikelope/megabasterd.git
synced 2025-05-28 20:40:13 +02:00
1.63
-Lock fix
This commit is contained in:
parent
6766c9fcde
commit
7ab4d9a62c
@ -62,6 +62,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
private volatile SpeedMeter _speed_meter = null; //lazy init
|
||||
private volatile ProgressMeter _progress_meter = null; //lazy init;
|
||||
private final Object _secure_notify_lock;
|
||||
private final Object _workers_lock;
|
||||
private boolean _notified;
|
||||
private final String _url;
|
||||
private final String _download_path;
|
||||
@ -121,6 +122,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
_slots = slots;
|
||||
_restart = restart;
|
||||
_secure_notify_lock = new Object();
|
||||
_workers_lock = new Object();
|
||||
_chunkworkers = new ArrayList<>();
|
||||
_partialProgressQueue = new ConcurrentLinkedQueue<>();
|
||||
_rejectedChunkIds = new ConcurrentLinkedQueue<>();
|
||||
@ -317,10 +319,13 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
getSpeed_meter().secureNotify();
|
||||
|
||||
synchronized (_workers_lock) {
|
||||
|
||||
for (ChunkDownloader downloader : getChunkworkers()) {
|
||||
|
||||
downloader.secureNotify();
|
||||
}
|
||||
}
|
||||
|
||||
getView().resume();
|
||||
|
||||
@ -1114,7 +1119,7 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
|
||||
getView().stop("Stopping download safely, please wait...");
|
||||
|
||||
synchronized (this) {
|
||||
synchronized (_workers_lock) {
|
||||
|
||||
for (ChunkDownloader downloader : _chunkworkers) {
|
||||
|
||||
@ -1122,6 +1127,8 @@ public final class Download implements Transference, Runnable, SecureNotifiable
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("stop4");
|
||||
|
||||
secureNotify();
|
||||
}
|
||||
}
|
||||
|
@ -354,12 +354,14 @@ public final class DownloadView extends javax.swing.JPanel implements Transferen
|
||||
private void stop_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stop_buttonActionPerformed
|
||||
|
||||
_download.stop();
|
||||
System.out.println("stopped");
|
||||
|
||||
}//GEN-LAST:event_stop_buttonActionPerformed
|
||||
|
||||
private void pause_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pause_buttonActionPerformed
|
||||
|
||||
_download.pause();
|
||||
System.out.println("paused!");
|
||||
}//GEN-LAST:event_pause_buttonActionPerformed
|
||||
|
||||
@Override
|
||||
|
@ -61,7 +61,7 @@ import org.apache.http.auth.UsernamePasswordCredentials;
|
||||
*/
|
||||
public final class MainPanel {
|
||||
|
||||
public static final String VERSION = "1.62";
|
||||
public static final String VERSION = "1.63";
|
||||
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
|
||||
public static final int STREAMER_PORT = 1337;
|
||||
public static final int WATCHDOG_PORT = 1338;
|
||||
|
@ -42,6 +42,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
private volatile boolean _exit;
|
||||
private final int _slots;
|
||||
private final Object _secure_notify_lock;
|
||||
private final Object _workers_lock;
|
||||
private byte[] _byte_file_key;
|
||||
private String _fatal_error;
|
||||
private volatile long _progress;
|
||||
@ -97,6 +98,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
_restart = restart;
|
||||
_completion_handle = null;
|
||||
_secure_notify_lock = new Object();
|
||||
_workers_lock = new Object();
|
||||
_chunkworkers = new ArrayList<>();
|
||||
_partialProgressQueue = new ConcurrentLinkedQueue<>();
|
||||
_rejectedChunkIds = new ConcurrentLinkedQueue<>();
|
||||
@ -494,10 +496,13 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
|
||||
getSpeed_meter().secureNotify();
|
||||
|
||||
synchronized (_workers_lock) {
|
||||
|
||||
for (ChunkUploader uploader : getChunkworkers()) {
|
||||
|
||||
uploader.secureNotify();
|
||||
}
|
||||
}
|
||||
|
||||
setPaused_workers(0);
|
||||
|
||||
@ -988,7 +993,7 @@ public final class Upload implements Transference, Runnable, SecureNotifiable {
|
||||
|
||||
getView().stop("Stopping upload safely, please wait...");
|
||||
|
||||
synchronized (this) {
|
||||
synchronized (_workers_lock) {
|
||||
|
||||
for (ChunkUploader uploader : _chunkworkers) {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user