-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring of the ERS3UploadQueue and ERCloudFilesUploadQueue to sha…
…re the same implementation and avoid accidental death of the queue thread The ERS3UploadQueue and ERCloudFilesUploadQueue are clearly duplicated. This commit introduces an abstract queue that handles all the logic to upload files asynchronously to a remote server. The upload process is unchanged. The queue logic was improved to perform all the upload logic (preparation + execution) inside of a try-catch block. This small change makes the queue much more robust by avoiding accidental death of the queue thread when an exception is thrown during the preparation phase.
- Loading branch information
Showing
7 changed files
with
202 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...works/BusinessLogic/ERAttachment/Sources/er/attachment/upload/ERAttachmentQueueEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package er.attachment.upload; | ||
|
||
import java.io.File; | ||
|
||
import er.attachment.model.ERAttachment; | ||
|
||
/** | ||
* The <code>ERAttachmentQueueEntry</code> is a wrapper that keeps a reference | ||
* to the <code>ERAttachment</code> and the file being enqueued for uploading. | ||
* | ||
* @author <a href="mailto:[email protected]">Henrique Prange</a> | ||
* | ||
* @param <T> | ||
* the type of the attachment that can queued for uploading. | ||
* | ||
* @see ERRemoteAttachment | ||
* @see ERAttachmentUploadQueue | ||
*/ | ||
public class ERAttachmentQueueEntry<T extends ERAttachment & ERRemoteAttachment> { | ||
private File _uploadedFile; | ||
private T _attachment; | ||
|
||
public ERAttachmentQueueEntry(File uploadedFile, T attachment) { | ||
_uploadedFile = uploadedFile; | ||
_attachment = attachment; | ||
} | ||
|
||
public File uploadedFile() { | ||
return _uploadedFile; | ||
} | ||
|
||
public T attachment() { | ||
return _attachment; | ||
} | ||
} |
Oops, something went wrong.