diff --git a/src/main/java/at/becast/youploader/youtube/upload/UploadManager.java b/src/main/java/at/becast/youploader/youtube/upload/UploadManager.java index 2ce75a1..43c6773 100644 --- a/src/main/java/at/becast/youploader/youtube/upload/UploadManager.java +++ b/src/main/java/at/becast/youploader/youtube/upload/UploadManager.java @@ -332,20 +332,20 @@ public void restart(int upload_id) { for(int i=0;i<_Uploading.size();i++){ if(_Uploading.get(i).id == upload_id){ UploadWorker o = _Uploading.get(i); + _Uploading.remove(i); + try { + o.join(); + } catch (InterruptedException e1) { + LOG.error("Upload worker thread timeout was interrupted", e1); + } if(o.retrys<5){ - try { - for(int s = 10; s>0;s--){ - o.frame.getProgressBar().setString(String.format(LANG.getString("Upload.Error"), s)); - Thread.sleep(1000); - } - } catch (InterruptedException e) { - LOG.error("Upload worker thread timeout was interrupted", e); + for(int s = 10; s>0;s--){ + o.frame.getProgressBar().setString(String.format(LANG.getString("Upload.Error"), s)); } - LOG.info("Restarting Upload {}",o.videodata.snippet.title); UploadWorker worker = new UploadWorker(upload_id, o.file, o.videodata, this.getSpeed_limit(), o.metadata, o.upload.url, o.upload.id, o.startAt); worker.setRetrys(o.getRetrys()); - _Uploading.set(i, worker); + _Uploading.addFirst(worker); worker.start(); }else{ o.frame.getProgressBar().setString(LANG.getString("Upload.Failed")); diff --git a/src/main/java/at/becast/youploader/youtube/upload/Uploader.java b/src/main/java/at/becast/youploader/youtube/upload/Uploader.java index c2d79ea..b410f9d 100644 --- a/src/main/java/at/becast/youploader/youtube/upload/Uploader.java +++ b/src/main/java/at/becast/youploader/youtube/upload/Uploader.java @@ -103,9 +103,8 @@ public void setPlaylists(String playlist, Upload upload) throws IOException, Upl public void abort() { try { - this.http.setAborted(true); - this.stream.abort(); - this.http.abort(); + this.stream.close(); + this.http.close(); } catch (Exception e) { } diff --git a/version b/version index 568965b..859b688 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.9.1-beta \ No newline at end of file +0.9.2-beta \ No newline at end of file